Rename InstanceDef -> InstanceKind
This commit is contained in:
parent
55cac26a9e
commit
342c1b03d6
53 changed files with 421 additions and 418 deletions
|
@ -288,9 +288,9 @@ pub fn transform_instance<'tcx>(
|
|||
mut instance: Instance<'tcx>,
|
||||
options: TransformTyOptions,
|
||||
) -> Instance<'tcx> {
|
||||
if (matches!(instance.def, ty::InstanceDef::Virtual(..))
|
||||
if (matches!(instance.def, ty::InstanceKind::Virtual(..))
|
||||
&& tcx.is_lang_item(instance.def_id(), LangItem::DropInPlace))
|
||||
|| matches!(instance.def, ty::InstanceDef::DropGlue(..))
|
||||
|| matches!(instance.def, ty::InstanceKind::DropGlue(..))
|
||||
{
|
||||
// Adjust the type ids of DropGlues
|
||||
//
|
||||
|
@ -316,7 +316,7 @@ pub fn transform_instance<'tcx>(
|
|||
let predicates = tcx.mk_poly_existential_predicates(&[ty::Binder::dummy(predicate)]);
|
||||
let self_ty = Ty::new_dynamic(tcx, predicates, tcx.lifetimes.re_erased, ty::Dyn);
|
||||
instance.args = tcx.mk_args_trait(self_ty, List::empty());
|
||||
} else if let ty::InstanceDef::Virtual(def_id, _) = instance.def {
|
||||
} else if let ty::InstanceKind::Virtual(def_id, _) = instance.def {
|
||||
// Transform self into a trait object of the trait that defines the method for virtual
|
||||
// functions to match the type erasure done below.
|
||||
let upcast_ty = match tcx.trait_of_item(def_id) {
|
||||
|
@ -343,7 +343,7 @@ pub fn transform_instance<'tcx>(
|
|||
tcx.types.unit
|
||||
};
|
||||
instance.args = tcx.mk_args_trait(self_ty, instance.args.into_iter().skip(1));
|
||||
} else if let ty::InstanceDef::VTableShim(def_id) = instance.def
|
||||
} else if let ty::InstanceKind::VTableShim(def_id) = instance.def
|
||||
&& let Some(trait_id) = tcx.trait_of_item(def_id)
|
||||
{
|
||||
// Adjust the type ids of VTableShims to the type id expected in the call sites for the
|
||||
|
@ -387,7 +387,7 @@ pub fn transform_instance<'tcx>(
|
|||
// If we ever *do* start encoding the vtable index, we will need to generate an alias set
|
||||
// based on which vtables we are putting this method into, as there will be more than one
|
||||
// index value when supertraits are involved.
|
||||
instance.def = ty::InstanceDef::Virtual(method_id, 0);
|
||||
instance.def = ty::InstanceKind::Virtual(method_id, 0);
|
||||
let abstract_trait_args =
|
||||
tcx.mk_args_trait(invoke_ty, trait_ref.args.into_iter().skip(1));
|
||||
instance.args = instance.args.rebase_onto(tcx, impl_id, abstract_trait_args);
|
||||
|
@ -442,7 +442,7 @@ pub fn transform_instance<'tcx>(
|
|||
.expect("No call-family function on closure-like Fn trait?")
|
||||
.def_id;
|
||||
|
||||
instance.def = ty::InstanceDef::Virtual(call, 0);
|
||||
instance.def = ty::InstanceKind::Virtual(call, 0);
|
||||
instance.args = abstract_args;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//!
|
||||
//! For more information about LLVM KCFI and cross-language LLVM KCFI support for the Rust compiler,
|
||||
//! see the tracking issue #123479.
|
||||
use rustc_middle::ty::{Instance, InstanceDef, ReifyReason, Ty, TyCtxt};
|
||||
use rustc_middle::ty::{Instance, InstanceKind, ReifyReason, Ty, TyCtxt};
|
||||
use rustc_target::abi::call::FnAbi;
|
||||
use std::hash::Hasher;
|
||||
use twox_hash::XxHash64;
|
||||
|
@ -44,7 +44,7 @@ pub fn typeid_for_instance<'tcx>(
|
|||
//
|
||||
// This was implemented for KCFI support in #123106 and #123052 (which introduced the
|
||||
// ReifyReason). The tracking issue for KCFI support for Rust is #123479.
|
||||
if matches!(instance.def, InstanceDef::ReifyShim(_, Some(ReifyReason::FnPtr))) {
|
||||
if matches!(instance.def, InstanceKind::ReifyShim(_, Some(ReifyReason::FnPtr))) {
|
||||
options.insert(TypeIdOptions::USE_CONCRETE_SELF);
|
||||
}
|
||||
// A KCFI type metadata identifier is a 32-bit constant produced by taking the lower half of the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue