Skip to content

Commit

Permalink
avoid redundant immutability check
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed May 23, 2021
1 parent 3bcba11 commit c3005e8
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions compiler/rustc_mir/src/interpret/memory.rs
Expand Up @@ -628,9 +628,6 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
// Need to make a copy, even if `get_global_alloc` is able
// to give us a cheap reference.
let alloc = Self::get_global_alloc(memory_extra, tcx, id, /*is_write*/ true)?;
if alloc.mutability == Mutability::Not {
throw_ub!(WriteToReadOnly(id))
}
let kind = M::GLOBAL_KIND.expect(
"I got a global allocation that I have to copy but the machine does \
not expect that to happen",
Expand Down

0 comments on commit c3005e8

Please sign in to comment.