diff options
| author | Ben Kimock <kimockb@gmail.com> | 2023-11-15 19:16:06 -0500 |
|---|---|---|
| committer | Ben Kimock <kimockb@gmail.com> | 2023-11-16 08:30:49 -0500 |
| commit | d7cecd3db24e3905a39f458e9202016a5685579a (patch) | |
| tree | 8d406cabcd07deb381ca54baceedb1604bfcb050 | |
| parent | 6b771f6b5a6c8b03b6322a9c77ac77cb346148f0 (diff) | |
| download | rust-d7cecd3db24e3905a39f458e9202016a5685579a.tar.gz rust-d7cecd3db24e3905a39f458e9202016a5685579a.zip | |
Let Miri see the AllocId for all TyCtxt allocations
| -rw-r--r-- | compiler/rustc_middle/src/mir/interpret/mod.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/mir/interpret/mod.rs b/compiler/rustc_middle/src/mir/interpret/mod.rs index e360fb3eaaf..b87c6885e04 100644 --- a/compiler/rustc_middle/src/mir/interpret/mod.rs +++ b/compiler/rustc_middle/src/mir/interpret/mod.rs @@ -525,6 +525,13 @@ impl<'tcx> TyCtxt<'tcx> { self.alloc_map.lock().reserve() } + /// Miri's provenance GC needs to see all live allocations. The interpreter manages most + /// allocations but some are managed by [`TyCtxt`] and without this method the interpreter + /// doesn't know their [`AllocId`]s are in use. + pub fn iter_allocs<F: FnMut(AllocId)>(self, func: F) { + self.alloc_map.lock().alloc_map.keys().copied().for_each(func) + } + /// Reserves a new ID *if* this allocation has not been dedup-reserved before. /// Should only be used for "symbolic" allocations (function pointers, vtables, statics), we /// don't want to dedup IDs for "real" memory! |
