From c3005e85da65fa62347cfd1cfcc756952521807d Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 23 May 2021 11:55:31 +0200 Subject: [PATCH] avoid redundant immutability check --- compiler/rustc_mir/src/interpret/memory.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/compiler/rustc_mir/src/interpret/memory.rs b/compiler/rustc_mir/src/interpret/memory.rs index c20607b39a16..c26fcf832886 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",