From: Ralf Jung Date: Mon, 15 Oct 2018 16:11:29 +0000 (+0200) Subject: fix checking Mut access on frozen location X-Git-Url: https://git.ralfj.de/web.git/commitdiff_plain/26e899f3e362eb1f0a3816e6470e1b8c58682a95?ds=inline;hp=c1bfa0255b4232ab1246cabd3142006acda7e731 fix checking Mut access on frozen location --- 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)) + } } }