Skip to content

Commit 586145a

Browse files
oli-obkRalfJung
andauthored
Update compiler/rustc_const_eval/src/interpret/validity.rs
Co-authored-by: Ralf Jung <post@ralfj.de>
1 parent 6ac9447 commit 586145a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compiler/rustc_const_eval/src/interpret/validity.rs

+4
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,10 @@ fn mutability<'mir, 'tcx: 'mir>(
722722
}
723723
_ => mutability,
724724
};
725+
// In case this allocation exists in our alloc_map (which means it is
726+
// the static we are evaluating), sanity-check the mutability.
727+
// We can't do this for other statics as their allocations are only
728+
// available via the query.
725729
if let Some((_, alloc)) = ecx.memory.alloc_map.get(alloc_id) {
726730
assert_eq!(alloc.mutability, mutability);
727731
}

0 commit comments

Comments
 (0)