summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2023-12-16 16:24:25 +0100
committerRalf Jung <post@ralfj.de>2024-01-22 09:28:00 +0100
commit2f1a8e2d7a641a398e9e02c8c99e80f6e44dce87 (patch)
treee8e044a80ab5b723153703589e31aa24308e2a6e /src
parenta58ec8ff03b3269b20104eb7eae407be48ab95a7 (diff)
downloadrust-2f1a8e2d7a641a398e9e02c8c99e80f6e44dce87.tar.gz
rust-2f1a8e2d7a641a398e9e02c8c99e80f6e44dce87.zip
const-eval interner: from-scratch rewrite using mutability information from provenance rather than types
Diffstat (limited to 'src')
-rw-r--r--src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs4
-rw-r--r--src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs4
2 files changed, 6 insertions, 2 deletions
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.