Skip to content

Commit 711519f

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 79734f1 commit 711519f

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;
@@ -390,18 +389,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
390389
instance: ty::InstanceDef<'tcx>,
391390
) -> InterpResult<'tcx, &'tcx mir::Body<'tcx>> {
392391
match instance {
393-
ty::InstanceDef::Item(def) => {
394-
if ecx.tcx.is_ctfe_mir_available(def) {
395-
Ok(ecx.tcx.mir_for_ctfe(def))
396-
} else if ecx.tcx.def_kind(def) == DefKind::AssocConst {
397-
ecx.tcx.dcx().bug("This is likely a const item that is missing from its impl");
398-
} else {
399-
// `find_mir_or_eval_fn` checks that this is a const fn before even calling us,
400-
// so this should be unreachable.
401-
let path = ecx.tcx.def_path_str(def);
402-
bug!("trying to call extern function `{path}` at compile-time");
403-
}
404-
}
392+
ty::InstanceDef::Item(def) => Ok(ecx.tcx.mir_for_ctfe(def)),
405393
_ => Ok(ecx.tcx.instance_mir(instance)),
406394
}
407395
}

0 commit comments

Comments
 (0)