diff --git a/compiler/rustc_const_eval/src/interpret/terminator.rs b/compiler/rustc_const_eval/src/interpret/terminator.rs index 35e7fac7b927..4d9e545e7f04 100644 --- a/compiler/rustc_const_eval/src/interpret/terminator.rs +++ b/compiler/rustc_const_eval/src/interpret/terminator.rs @@ -251,15 +251,16 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { } mir::Operand::Move(place) => { let place = self.eval_place(*place)?; + let op = self.place_to_op(&place)?; - match place.as_mplace_or_local() { + match op.as_mplace_or_imm() { Either::Left(mplace) => FnArg::InPlace(mplace), - Either::Right(_local) => { + Either::Right(_imm) => { // This argument doesn't live in memory, so there's no place // to make inaccessible during the call. // This is also crucial for tail calls, where we want the `FnArg` to // stay valid when the old stack frame gets popped. - FnArg::Copy(self.place_to_op(&place)?) + FnArg::Copy(op) } } } @@ -742,7 +743,9 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { }); } - if let Either::Left(destination) = destination.as_mplace_or_local() { + if let Either::Left(destination) = + self.place_to_op(&destination)?.as_mplace_or_imm() + { // Protect return place for in-place return value passing. M::protect_in_place_function_argument(self, &destination)?; }