Skip to content

Commit c3005e8

Browse files
committed
avoid redundant immutability check
1 parent 3bcba11 commit c3005e8

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

compiler/rustc_mir/src/interpret/memory.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -628,9 +628,6 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
628628
// Need to make a copy, even if `get_global_alloc` is able
629629
// to give us a cheap reference.
630630
let alloc = Self::get_global_alloc(memory_extra, tcx, id, /*is_write*/ true)?;
631-
if alloc.mutability == Mutability::Not {
632-
throw_ub!(WriteToReadOnly(id))
633-
}
634631
let kind = M::GLOBAL_KIND.expect(
635632
"I got a global allocation that I have to copy but the machine does \
636633
not expect that to happen",

0 commit comments

Comments
 (0)