Fix correctness of optimization

This commit is contained in:
bjorn3 2020-01-25 16:24:15 +01:00
parent 9cfb9470c5
commit 242f2e3c75

View file

@ -363,7 +363,7 @@ pub fn codegen_fn_prelude(fx: &mut FunctionCx<'_, '_, impl Backend>, start_ebb:
ParamEnv::reveal_all(),
local_decl.source_info.span,
);
if local_decl.mutability == mir::Mutability::Not && internally_mutable {
if local_decl.mutability == mir::Mutability::Not && !internally_mutable {
// We wont mutate this argument, so it is fine to borrow the backing storage
// of this argument, to prevent a copy.