Skip to content

Commit

Permalink
Unrolled build for rust-lang#136166
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#136166 - RalfJung:interpet-is-alloc-live, r=compiler-errors

interpret: is_alloc_live: check global allocs last

See rust-lang#136105 (comment).

(A perf run makes no sense as this is only used by Miri.)
  • Loading branch information
rust-timer authored Jan 29, 2025
2 parents 61cc3e5 + bc135aa commit 595a5a3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions compiler/rustc_const_eval/src/interpret/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -830,9 +830,11 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
/// [`InterpCx::get_alloc_info`] if all you need to check is whether the kind is
/// [`AllocKind::Dead`] because it doesn't have to look up the type and layout of statics.
pub fn is_alloc_live(&self, id: AllocId) -> bool {
self.tcx.try_get_global_alloc(id).is_some()
|| self.memory.alloc_map.contains_key_ref(&id)
self.memory.alloc_map.contains_key_ref(&id)
|| self.memory.extra_fn_ptr_map.contains_key(&id)
// We check `tcx` last as that has to acquire a lock in `many-seeds` mode.
// This also matches the order in `get_alloc_info`.
|| self.tcx.try_get_global_alloc(id).is_some()
}

/// Obtain the size and alignment of an allocation, even if that allocation has
Expand Down

0 comments on commit 595a5a3

Please sign in to comment.