rename get_global_alloc to try_get_global_alloc
This commit is contained in:
@@ -369,7 +369,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
|
||||
// we don't deallocate it.
|
||||
let (alloc_id, _, _) = ecx.ptr_get_alloc_id(ptr)?;
|
||||
let is_allocated_in_another_const = matches!(
|
||||
ecx.tcx.get_global_alloc(alloc_id),
|
||||
ecx.tcx.try_get_global_alloc(alloc_id),
|
||||
Some(interpret::GlobalAlloc::Memory(_))
|
||||
);
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ pub(crate) fn deref_mir_constant<'tcx>(
|
||||
let mplace = ecx.deref_operand(&op).unwrap();
|
||||
if let Some(alloc_id) = mplace.ptr.provenance {
|
||||
assert_eq!(
|
||||
tcx.get_global_alloc(alloc_id).unwrap().unwrap_memory().0.0.mutability,
|
||||
tcx.global_alloc(alloc_id).unwrap_memory().0.0.mutability,
|
||||
Mutability::Not,
|
||||
"deref_mir_constant cannot be used with mutable allocations as \
|
||||
that could allow pattern matching to observe mutable statics",
|
||||
|
||||
Reference in New Issue
Block a user