Remove WithOptconstParam.
This commit is contained in:
parent
0e017fc94a
commit
b275d2c30b
68 changed files with 335 additions and 960 deletions
|
@ -296,12 +296,12 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
|
|||
}
|
||||
|
||||
let cid = key.value;
|
||||
let def = cid.instance.def.with_opt_param();
|
||||
let is_static = tcx.is_static(def.did);
|
||||
let def = cid.instance.def.def_id();
|
||||
let is_static = tcx.is_static(def);
|
||||
|
||||
let mut ecx = InterpCx::new(
|
||||
tcx,
|
||||
tcx.def_span(def.did),
|
||||
tcx.def_span(def),
|
||||
key.param_env,
|
||||
// Statics (and promoteds inside statics) may access other statics, because unlike consts
|
||||
// they do not have to behave "as if" they were evaluated at runtime.
|
||||
|
|
|
@ -375,9 +375,9 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
|
|||
) -> InterpResult<'tcx, &'tcx mir::Body<'tcx>> {
|
||||
match instance {
|
||||
ty::InstanceDef::Item(def) => {
|
||||
if ecx.tcx.is_ctfe_mir_available(def.did) {
|
||||
Ok(ecx.tcx.mir_for_ctfe_opt_const_arg(def))
|
||||
} else if ecx.tcx.def_kind(def.did) == DefKind::AssocConst {
|
||||
if ecx.tcx.is_ctfe_mir_available(def) {
|
||||
Ok(ecx.tcx.mir_for_ctfe(def))
|
||||
} else if ecx.tcx.def_kind(def) == DefKind::AssocConst {
|
||||
let guar = ecx.tcx.sess.delay_span_bug(
|
||||
rustc_span::DUMMY_SP,
|
||||
"This is likely a const item that is missing from its impl",
|
||||
|
@ -386,7 +386,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
|
|||
} else {
|
||||
// `find_mir_or_eval_fn` checks that this is a const fn before even calling us,
|
||||
// so this should be unreachable.
|
||||
let path = ecx.tcx.def_path_str(def.did);
|
||||
let path = ecx.tcx.def_path_str(def);
|
||||
bug!("trying to call extern function `{path}` at compile-time");
|
||||
}
|
||||
}
|
||||
|
@ -410,9 +410,9 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
|
|||
// Execution might have wandered off into other crates, so we cannot do a stability-
|
||||
// sensitive check here. But we can at least rule out functions that are not const
|
||||
// at all.
|
||||
if !ecx.tcx.is_const_fn_raw(def.did) {
|
||||
if !ecx.tcx.is_const_fn_raw(def) {
|
||||
// allow calling functions inside a trait marked with #[const_trait].
|
||||
if !ecx.tcx.is_const_default_method(def.did) {
|
||||
if !ecx.tcx.is_const_default_method(def) {
|
||||
// We certainly do *not* want to actually call the fn
|
||||
// though, so be sure we return here.
|
||||
throw_unsup_format!("calling non-const function `{}`", instance)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue