Skip to content

Commit 4e63561

Browse files
committed
Check that const_panic_fmt is const too.
1 parent 38bf5b0 commit 4e63561

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

compiler/rustc_mir/src/const_eval/machine.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
238238

239239
fn find_mir_or_eval_fn(
240240
ecx: &mut InterpCx<'mir, 'tcx, Self>,
241-
mut instance: ty::Instance<'tcx>,
241+
instance: ty::Instance<'tcx>,
242242
_abi: Abi,
243243
args: &[OpTy<'tcx>],
244244
_ret: Option<(&PlaceTy<'tcx>, mir::BasicBlock)>,
@@ -258,7 +258,14 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
258258
// that for const fn!
259259
if let Some(new_instance) = ecx.hook_panic_fn(instance, args)? {
260260
// We call another const fn instead.
261-
instance = new_instance;
261+
return Self::find_mir_or_eval_fn(
262+
ecx,
263+
new_instance,
264+
_abi,
265+
args,
266+
_ret,
267+
_unwind,
268+
);
262269
} else {
263270
// We certainly do *not* want to actually call the fn
264271
// though, so be sure we return here.

0 commit comments

Comments
 (0)