Skip to content

Commit 8a8c8c9

Browse files
committed
Remove unnecessary .clone(), by making remove_const not alias with locals_of_current_block
1 parent 45f1775 commit 8a8c8c9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/librustc_mir/transform/const_prop.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,8 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
425425

426426
/// Remove `local` from the pool of `Locals`. Allows writing to them,
427427
/// but not reading from them anymore.
428-
fn remove_const(&mut self, local: Local) {
429-
self.ecx.frame_mut().locals[local] =
428+
fn remove_const(ecx: &mut InterpCx<'mir, 'tcx, ConstPropMachine<'mir, 'tcx>>, local: Local) {
429+
ecx.frame_mut().locals[local] =
430430
LocalState { value: LocalValue::Uninitialized, layout: Cell::new(None) };
431431
}
432432

@@ -913,7 +913,7 @@ impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx> {
913913
{
914914
trace!("can't propagate into {:?}", local);
915915
if local != RETURN_PLACE {
916-
self.remove_const(local);
916+
Self::remove_const(&mut self.ecx, local);
917917
}
918918
}
919919
}
@@ -952,7 +952,7 @@ impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx> {
952952
// doesn't use the invalid value
953953
match cond {
954954
Operand::Move(ref place) | Operand::Copy(ref place) => {
955-
self.remove_const(place.local);
955+
Self::remove_const(&mut self.ecx, place.local);
956956
}
957957
Operand::Constant(_) => {}
958958
}
@@ -1064,7 +1064,7 @@ impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx> {
10641064
"removing local {:?} from const-prop, since it's restricted to just its own block.",
10651065
local
10661066
);
1067-
self.remove_const(local);
1067+
Self::remove_const(&mut self.ecx, local);
10681068
}
10691069
// Before moving on to the next block, we must forget all restricted locals, because we
10701070
// have already removed them from the `const` pool

0 commit comments

Comments
 (0)