From 2f1a8e2d7a641a398e9e02c8c99e80f6e44dce87 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 16 Dec 2023 16:24:25 +0100 Subject: const-eval interner: from-scratch rewrite using mutability information from provenance rather than types --- src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs | 4 +++- src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src/tools/miri') diff --git a/src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs b/src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs index eac315d0436..7740d383ee3 100644 --- a/src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs +++ b/src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs @@ -830,7 +830,9 @@ trait EvalContextPrivExt<'mir: 'ecx, 'tcx: 'mir, 'ecx>: crate::MiriInterpCxExt<' let new_prov = this.sb_reborrow(place, size, new_perm, new_tag, info)?; // Adjust place. - Ok(place.clone().map_provenance(|_| new_prov)) + // (If the closure gets called, that means the old provenance was `Some`, and hence the new + // one must also be `Some`.) + Ok(place.clone().map_provenance(|_| new_prov.unwrap())) } /// Retags an individual pointer, returning the retagged version. diff --git a/src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs b/src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs index 573d13bf4a5..0945a5292bb 100644 --- a/src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs +++ b/src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs @@ -351,7 +351,9 @@ trait EvalContextPrivExt<'mir: 'ecx, 'tcx: 'mir, 'ecx>: crate::MiriInterpCxExt<' let new_prov = this.tb_reborrow(place, reborrow_size, new_perm, new_tag)?; // Adjust place. - Ok(place.clone().map_provenance(|_| new_prov)) + // (If the closure gets called, that means the old provenance was `Some`, and hence the new + // one must also be `Some`.) + Ok(place.clone().map_provenance(|_| new_prov.unwrap())) } /// Retags an individual pointer, returning the retagged version. -- cgit 1.4.1-3-g733a5