Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 60f352f

Browse files
author
Lukas Markeffsky
committed
replace potential ICE with graceful error (no_core only)
1 parent 8a60536 commit 60f352f

File tree

1 file changed

+2
-3
lines changed
  • compiler/rustc_const_eval/src/const_eval

1 file changed

+2
-3
lines changed

compiler/rustc_const_eval/src/const_eval/machine.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use rustc_hir::def::DefKind;
2+
use rustc_hir::LangItem;
23
use rustc_middle::mir;
34
use rustc_middle::mir::interpret::PointerArithmetic;
45
use rustc_middle::ty::layout::LayoutOf;
@@ -178,9 +179,7 @@ impl<'mir, 'tcx: 'mir> CompileTimeEvalContext<'mir, 'tcx> {
178179
return Err(ConstEvalErrKind::Panic { msg, file, line, col }.into());
179180
} else if Some(def_id) == self.tcx.lang_items().panic_fmt() {
180181
// For panic_fmt, call const_panic_fmt instead.
181-
let Some(const_def_id) = self.tcx.lang_items().const_panic_fmt() else {
182-
bug!("`const_panic_fmt` must be defined to call `panic_fmt` in const eval")
183-
};
182+
let const_def_id = self.tcx.require_lang_item(LangItem::ConstPanicFmt, None);
184183
let new_instance = ty::Instance::resolve(
185184
*self.tcx,
186185
ty::ParamEnv::reveal_all(),

0 commit comments

Comments
 (0)