Skip to content

Commit

Permalink
Update compiler/rustc_const_eval/src/interpret/validity.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Ralf Jung <post@ralfj.de>
  • Loading branch information
oli-obk and RalfJung authored Apr 16, 2024
1 parent 6ac9447 commit 586145a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions compiler/rustc_const_eval/src/interpret/validity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,10 @@ fn mutability<'mir, 'tcx: 'mir>(
}
_ => mutability,
};
// In case this allocation exists in our alloc_map (which means it is
// the static we are evaluating), sanity-check the mutability.
// We can't do this for other statics as their allocations are only
// available via the query.
if let Some((_, alloc)) = ecx.memory.alloc_map.get(alloc_id) {
assert_eq!(alloc.mutability, mutability);
}
Expand Down

0 comments on commit 586145a

Please sign in to comment.