From 4157380c448d7157a4f45b55b5187c29d3f31ec1 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 15 Oct 2018 18:11:29 +0200 Subject: [PATCH 1/1] fix checking Mut access on frozen location --- personal/_posts/2018-08-07-stacked-borrows.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/personal/_posts/2018-08-07-stacked-borrows.md b/personal/_posts/2018-08-07-stacked-borrows.md index 94f2bb6..37cdf50 100644 --- a/personal/_posts/2018-08-07-stacked-borrows.md +++ b/personal/_posts/2018-08-07-stacked-borrows.md @@ -336,8 +336,11 @@ impl MemoryByte { self.frz_since.map_or(false, |loc_t| loc_t <= acc_t), Mut(acc_m) => // Raw pointers are fine with frozen locations. This is important because &Cell is raw! - (acc_m.is_raw() && self.frozen_since.is_some()) || - self.borrows.last().map_or(false, |loc_itm| loc_itm == Mut(acc_m)), + if self.frozen_since.is_some() { + acc_m.is_raw() + } else { + self.borrows.last().map_or(false, |loc_itm| loc_itm == Mut(acc_m)) + } } } -- 2.30.2