diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index d00411548e9..6f48396cdd7 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -315,23 +315,16 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { } /// Call this on things you got out of the MIR (so it is as generic as the current - /// stack rameframe), to bring it into the proper environment for this interpreter. + /// stack frame), to bring it into the proper environment for this interpreter. pub(super) fn subst_from_frame_and_normalize_erasing_regions>( &self, - t: T, - ) -> InterpResult<'tcx, T> { - match self.stack.last() { - Some(frame) => Ok(self.tcx.subst_and_normalize_erasing_regions( - frame.instance.substs, - self.param_env, - &t, - )), - None => if t.needs_subst() { - throw_inval!(TooGeneric) - } else { - Ok(t) - }, - } + value: T, + ) -> T { + self.tcx.subst_and_normalize_erasing_regions( + self.frame().instance.substs, + self.param_env, + &value, + ) } /// The `substs` are assumed to already be in our interpreter "universe" (param_env). diff --git a/src/librustc_mir/interpret/place.rs b/src/librustc_mir/interpret/place.rs index 71b9c83d615..85f9cbd3758 100644 --- a/src/librustc_mir/interpret/place.rs +++ b/src/librustc_mir/interpret/place.rs @@ -643,7 +643,7 @@ where layout: self.layout_of( self.subst_from_frame_and_normalize_erasing_regions( self.frame().body.return_ty() - )? + ) )?, } } diff --git a/src/librustc_mir/interpret/step.rs b/src/librustc_mir/interpret/step.rs index 5a9cf888c93..ca4da451a1f 100644 --- a/src/librustc_mir/interpret/step.rs +++ b/src/librustc_mir/interpret/step.rs @@ -254,7 +254,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { } NullaryOp(mir::NullOp::SizeOf, ty) => { - let ty = self.subst_from_frame_and_normalize_erasing_regions(ty)?; + let ty = self.subst_from_frame_and_normalize_erasing_regions(ty); let layout = self.layout_of(ty)?; assert!(!layout.is_unsized(), "SizeOf nullary MIR operator called for unsized type");