Skip to content

Commit be94ca0

Browse files
committed
Remove a CTFE check that was only ever used to ICE
The guarded call will ICE on its own. While this improved diagnostics in the presence of bugs somewhat, it is also a blocker to query feeding of constants. If this case is hit again, we should instead improve diagnostics of the root ICE
1 parent f989d2f commit be94ca0

File tree

1 file changed

+1
-13
lines changed
  • compiler/rustc_const_eval/src/const_eval

1 file changed

+1
-13
lines changed

compiler/rustc_const_eval/src/const_eval/machine.rs

+1-13
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use std::ops::ControlFlow;
66
use rustc_ast::Mutability;
77
use rustc_data_structures::fx::FxIndexMap;
88
use rustc_data_structures::fx::IndexEntry;
9-
use rustc_hir::def::DefKind;
109
use rustc_hir::def_id::DefId;
1110
use rustc_hir::def_id::LocalDefId;
1211
use rustc_hir::LangItem;
@@ -392,18 +391,7 @@ impl<'tcx> interpret::Machine<'tcx> for CompileTimeInterpreter<'tcx> {
392391
instance: ty::InstanceDef<'tcx>,
393392
) -> InterpResult<'tcx, &'tcx mir::Body<'tcx>> {
394393
match instance {
395-
ty::InstanceDef::Item(def) => {
396-
if ecx.tcx.is_ctfe_mir_available(def) {
397-
Ok(ecx.tcx.mir_for_ctfe(def))
398-
} else if ecx.tcx.def_kind(def) == DefKind::AssocConst {
399-
ecx.tcx.dcx().bug("This is likely a const item that is missing from its impl");
400-
} else {
401-
// `find_mir_or_eval_fn` checks that this is a const fn before even calling us,
402-
// so this should be unreachable.
403-
let path = ecx.tcx.def_path_str(def);
404-
bug!("trying to call extern function `{path}` at compile-time");
405-
}
406-
}
394+
ty::InstanceDef::Item(def) => Ok(ecx.tcx.mir_for_ctfe(def)),
407395
_ => Ok(ecx.tcx.instance_mir(instance)),
408396
}
409397
}

0 commit comments

Comments
 (0)