Rename InstanceDef -> InstanceKind
This commit is contained in:
@@ -34,7 +34,7 @@ fn resolve_instance<'tcx>(
|
||||
} else {
|
||||
let def = if tcx.intrinsic(def_id).is_some() {
|
||||
debug!(" => intrinsic");
|
||||
ty::InstanceDef::Intrinsic(def_id)
|
||||
ty::InstanceKind::Intrinsic(def_id)
|
||||
} else if tcx.is_lang_item(def_id, LangItem::DropInPlace) {
|
||||
let ty = args.type_at(0);
|
||||
|
||||
@@ -53,10 +53,10 @@ fn resolve_instance<'tcx>(
|
||||
_ => return Ok(None),
|
||||
}
|
||||
|
||||
ty::InstanceDef::DropGlue(def_id, Some(ty))
|
||||
ty::InstanceKind::DropGlue(def_id, Some(ty))
|
||||
} else {
|
||||
debug!(" => trivial drop glue");
|
||||
ty::InstanceDef::DropGlue(def_id, None)
|
||||
ty::InstanceKind::DropGlue(def_id, None)
|
||||
}
|
||||
} else if tcx.is_lang_item(def_id, LangItem::AsyncDropInPlace) {
|
||||
let ty = args.type_at(0);
|
||||
@@ -75,15 +75,15 @@ fn resolve_instance<'tcx>(
|
||||
_ => return Ok(None),
|
||||
}
|
||||
debug!(" => nontrivial async drop glue ctor");
|
||||
ty::InstanceDef::AsyncDropGlueCtorShim(def_id, Some(ty))
|
||||
ty::InstanceKind::AsyncDropGlueCtorShim(def_id, Some(ty))
|
||||
} else {
|
||||
debug!(" => trivial async drop glue ctor");
|
||||
ty::InstanceDef::AsyncDropGlueCtorShim(def_id, None)
|
||||
ty::InstanceKind::AsyncDropGlueCtorShim(def_id, None)
|
||||
}
|
||||
} else {
|
||||
debug!(" => free item");
|
||||
// FIXME(effects): we may want to erase the effect param if that is present on this item.
|
||||
ty::InstanceDef::Item(def_id)
|
||||
ty::InstanceKind::Item(def_id)
|
||||
};
|
||||
|
||||
Ok(Some(Instance { def, args }))
|
||||
@@ -226,7 +226,7 @@ fn resolve_associated_item<'tcx>(
|
||||
.copied()
|
||||
.position(|def_id| def_id == trait_item_id);
|
||||
offset.map(|offset| Instance {
|
||||
def: ty::InstanceDef::Virtual(trait_item_id, vtable_base + offset),
|
||||
def: ty::InstanceKind::Virtual(trait_item_id, vtable_base + offset),
|
||||
args: rcvr_args,
|
||||
})
|
||||
}
|
||||
@@ -248,7 +248,7 @@ fn resolve_associated_item<'tcx>(
|
||||
};
|
||||
|
||||
Some(Instance {
|
||||
def: ty::InstanceDef::CloneShim(trait_item_id, self_ty),
|
||||
def: ty::InstanceKind::CloneShim(trait_item_id, self_ty),
|
||||
args: rcvr_args,
|
||||
})
|
||||
} else {
|
||||
@@ -265,7 +265,7 @@ fn resolve_associated_item<'tcx>(
|
||||
return Ok(None);
|
||||
}
|
||||
Some(Instance {
|
||||
def: ty::InstanceDef::FnPtrAddrShim(trait_item_id, self_ty),
|
||||
def: ty::InstanceKind::FnPtrAddrShim(trait_item_id, self_ty),
|
||||
args: rcvr_args,
|
||||
})
|
||||
} else {
|
||||
@@ -283,7 +283,7 @@ fn resolve_associated_item<'tcx>(
|
||||
{
|
||||
// For compiler developers who'd like to add new items to `Fn`/`FnMut`/`FnOnce`,
|
||||
// you either need to generate a shim body, or perhaps return
|
||||
// `InstanceDef::Item` pointing to a trait default method body if
|
||||
// `InstanceKind::Item` pointing to a trait default method body if
|
||||
// it is given a default implementation by the trait.
|
||||
bug!(
|
||||
"no definition for `{trait_ref}::{}` for built-in callable type",
|
||||
@@ -295,7 +295,7 @@ fn resolve_associated_item<'tcx>(
|
||||
Some(Instance::resolve_closure(tcx, closure_def_id, args, target_kind))
|
||||
}
|
||||
ty::FnDef(..) | ty::FnPtr(..) => Some(Instance {
|
||||
def: ty::InstanceDef::FnPtrShim(trait_item_id, rcvr_args.type_at(0)),
|
||||
def: ty::InstanceKind::FnPtrShim(trait_item_id, rcvr_args.type_at(0)),
|
||||
args: rcvr_args,
|
||||
}),
|
||||
ty::CoroutineClosure(coroutine_closure_def_id, args) => {
|
||||
@@ -308,7 +308,7 @@ fn resolve_associated_item<'tcx>(
|
||||
Some(Instance::new(coroutine_closure_def_id, args))
|
||||
} else {
|
||||
Some(Instance {
|
||||
def: ty::InstanceDef::ConstructCoroutineInClosureShim {
|
||||
def: ty::InstanceKind::ConstructCoroutineInClosureShim {
|
||||
coroutine_closure_def_id,
|
||||
receiver_by_ref: target_kind != ty::ClosureKind::FnOnce,
|
||||
},
|
||||
@@ -331,7 +331,7 @@ fn resolve_associated_item<'tcx>(
|
||||
// If we're computing `AsyncFnOnce` for a by-ref closure then
|
||||
// construct a new body that has the right return types.
|
||||
Some(Instance {
|
||||
def: ty::InstanceDef::ConstructCoroutineInClosureShim {
|
||||
def: ty::InstanceKind::ConstructCoroutineInClosureShim {
|
||||
coroutine_closure_def_id,
|
||||
receiver_by_ref: false,
|
||||
},
|
||||
@@ -345,7 +345,7 @@ fn resolve_associated_item<'tcx>(
|
||||
Some(Instance::resolve_closure(tcx, closure_def_id, args, target_kind))
|
||||
}
|
||||
ty::FnDef(..) | ty::FnPtr(..) => Some(Instance {
|
||||
def: ty::InstanceDef::FnPtrShim(trait_item_id, rcvr_args.type_at(0)),
|
||||
def: ty::InstanceKind::FnPtrShim(trait_item_id, rcvr_args.type_at(0)),
|
||||
args: rcvr_args,
|
||||
}),
|
||||
_ => bug!(
|
||||
|
||||
Reference in New Issue
Block a user