1
Fork 0

Rename InstanceDef -> InstanceKind

This commit is contained in:
Michael Goulet 2024-06-16 21:35:16 -04:00
parent 55cac26a9e
commit 342c1b03d6
53 changed files with 421 additions and 418 deletions

View file

@ -289,7 +289,7 @@ pub fn eval_to_const_value_raw_provider<'tcx>(
// We call `const_eval` for zero arg intrinsics, too, in order to cache their value.
// Catch such calls and evaluate them instead of trying to load a constant's MIR.
if let ty::InstanceDef::Intrinsic(def_id) = key.value.instance.def {
if let ty::InstanceKind::Intrinsic(def_id) = key.value.instance.def {
let ty = key.value.instance.ty(tcx, key.param_env);
let ty::FnDef(_, args) = ty.kind() else {
bug!("intrinsic with type {:?}", ty);

View file

@ -398,10 +398,10 @@ impl<'tcx> interpret::Machine<'tcx> for CompileTimeMachine<'tcx> {
fn load_mir(
ecx: &InterpCx<'tcx, Self>,
instance: ty::InstanceDef<'tcx>,
instance: ty::InstanceKind<'tcx>,
) -> InterpResult<'tcx, &'tcx mir::Body<'tcx>> {
match instance {
ty::InstanceDef::Item(def) => Ok(ecx.tcx.mir_for_ctfe(def)),
ty::InstanceKind::Item(def) => Ok(ecx.tcx.mir_for_ctfe(def)),
_ => Ok(ecx.tcx.instance_mir(instance)),
}
}
@ -424,7 +424,7 @@ impl<'tcx> interpret::Machine<'tcx> for CompileTimeMachine<'tcx> {
};
// Only check non-glue functions
if let ty::InstanceDef::Item(def) = instance.def {
if let ty::InstanceKind::Item(def) = instance.def {
// 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. That said, we have to allow calling functions inside a trait marked with
@ -540,7 +540,7 @@ impl<'tcx> interpret::Machine<'tcx> for CompileTimeMachine<'tcx> {
);
}
return Ok(Some(ty::Instance {
def: ty::InstanceDef::Item(instance.def_id()),
def: ty::InstanceKind::Item(instance.def_id()),
args: instance.args,
}));
}