Skip to content

Commit 42b105e

Browse files
authored
Rollup merge of #143584 - fee1-dead-contrib:push-skswvrwsrmll, r=RalfJung
make `Machine::load_mir` infallible it doesn't need to return an `InterpResult`.
2 parents f5df1f5 + be6cd11 commit 42b105e

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

compiler/rustc_const_eval/src/const_eval/machine.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,10 @@ impl<'tcx> interpret::Machine<'tcx> for CompileTimeMachine<'tcx> {
331331
fn load_mir(
332332
ecx: &InterpCx<'tcx, Self>,
333333
instance: ty::InstanceKind<'tcx>,
334-
) -> InterpResult<'tcx, &'tcx mir::Body<'tcx>> {
334+
) -> &'tcx mir::Body<'tcx> {
335335
match instance {
336-
ty::InstanceKind::Item(def) => interp_ok(ecx.tcx.mir_for_ctfe(def)),
337-
_ => interp_ok(ecx.tcx.instance_mir(instance)),
336+
ty::InstanceKind::Item(def) => ecx.tcx.mir_for_ctfe(def),
337+
_ => ecx.tcx.instance_mir(instance),
338338
}
339339
}
340340

compiler/rustc_const_eval/src/interpret/eval_context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
272272
let def = instance.def_id();
273273
&self.tcx.promoted_mir(def)[promoted]
274274
} else {
275-
M::load_mir(self, instance)?
275+
M::load_mir(self, instance)
276276
};
277277
// do not continue if typeck errors occurred (can only occur in local crate)
278278
if let Some(err) = body.tainted_by_errors {

compiler/rustc_const_eval/src/interpret/machine.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ pub trait Machine<'tcx>: Sized {
189189
fn load_mir(
190190
ecx: &InterpCx<'tcx, Self>,
191191
instance: ty::InstanceKind<'tcx>,
192-
) -> InterpResult<'tcx, &'tcx mir::Body<'tcx>> {
193-
interp_ok(ecx.tcx.instance_mir(instance))
192+
) -> &'tcx mir::Body<'tcx> {
193+
ecx.tcx.instance_mir(instance)
194194
}
195195

196196
/// Entry point to all function calls.

0 commit comments

Comments
 (0)