about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2021-05-23 11:55:31 +0200
committerRalf Jung <post@ralfj.de>2021-05-23 11:55:31 +0200
commitc3005e85da65fa62347cfd1cfcc756952521807d (patch)
treef0cf21a6e45e9ebf4aa8d10bd8937c282796e46d
parent3bcba11c353c15f3e8d95d330cb1fa98bacc652d (diff)
downloadrust-c3005e85da65fa62347cfd1cfcc756952521807d.tar.gz
rust-c3005e85da65fa62347cfd1cfcc756952521807d.zip
avoid redundant immutability check
-rw-r--r--compiler/rustc_mir/src/interpret/memory.rs3
1 files changed, 0 insertions, 3 deletions
diff --git a/compiler/rustc_mir/src/interpret/memory.rs b/compiler/rustc_mir/src/interpret/memory.rs
index c20607b39a1..c26fcf83288 100644
--- a/compiler/rustc_mir/src/interpret/memory.rs
+++ b/compiler/rustc_mir/src/interpret/memory.rs
@@ -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",