remove bound_type_of query; make type_of return EarlyBinder; change type_of in metadata

This commit is contained in:
Kyle Matsuda 2023-02-07 01:29:48 -07:00
parent d822b97a27
commit c183110cc2
164 changed files with 325 additions and 380 deletions

View file

@ -182,11 +182,9 @@ impl<'tcx> LateLintPass<'tcx> for BoxPointers {
| hir::ItemKind::TyAlias(..)
| hir::ItemKind::Enum(..)
| hir::ItemKind::Struct(..)
| hir::ItemKind::Union(..) => self.check_heap_type(
cx,
it.span,
cx.tcx.bound_type_of(it.owner_id).subst_identity(),
),
| hir::ItemKind::Union(..) => {
self.check_heap_type(cx, it.span, cx.tcx.type_of(it.owner_id).subst_identity())
}
_ => (),
}
@ -197,7 +195,7 @@ impl<'tcx> LateLintPass<'tcx> for BoxPointers {
self.check_heap_type(
cx,
field.span,
cx.tcx.bound_type_of(field.def_id).subst_identity(),
cx.tcx.type_of(field.def_id).subst_identity(),
);
}
}
@ -595,7 +593,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
// If the method is an impl for an item with docs_hidden, don't doc.
MethodLateContext::PlainImpl => {
let parent = cx.tcx.hir().get_parent_item(impl_item.hir_id());
let impl_ty = cx.tcx.bound_type_of(parent).subst_identity();
let impl_ty = cx.tcx.type_of(parent).subst_identity();
let outerdef = match impl_ty.kind() {
ty::Adt(def, _) => Some(def.did()),
ty::Foreign(def_id) => Some(*def_id),
@ -704,7 +702,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingCopyImplementations {
// and recommending Copy might be a bad idea.
for field in def.all_fields() {
let did = field.did;
if cx.tcx.bound_type_of(did).subst_identity().is_unsafe_ptr() {
if cx.tcx.type_of(did).subst_identity().is_unsafe_ptr() {
return;
}
}
@ -804,7 +802,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDebugImplementations {
if self.impling_types.is_none() {
let mut impls = LocalDefIdSet::default();
cx.tcx.for_each_impl(debug, |d| {
if let Some(ty_def) = cx.tcx.bound_type_of(d).subst_identity().ty_adt_def() {
if let Some(ty_def) = cx.tcx.type_of(d).subst_identity().ty_adt_def() {
if let Some(def_id) = ty_def.did().as_local() {
impls.insert(def_id);
}
@ -2858,8 +2856,8 @@ impl ClashingExternDeclarations {
structurally_same_type_impl(
seen_types,
cx,
tcx.bound_type_of(a_did).subst_identity(),
tcx.bound_type_of(b_did).subst_identity(),
tcx.type_of(a_did).subst_identity(),
tcx.type_of(b_did).subst_identity(),
ckind,
)
},
@ -2959,8 +2957,8 @@ impl<'tcx> LateLintPass<'tcx> for ClashingExternDeclarations {
if let ForeignItemKind::Fn(..) = this_fi.kind {
let tcx = cx.tcx;
if let Some(existing_did) = self.insert(tcx, this_fi) {
let existing_decl_ty = tcx.bound_type_of(existing_did).skip_binder();
let this_decl_ty = tcx.bound_type_of(this_fi.owner_id).subst_identity();
let existing_decl_ty = tcx.type_of(existing_did).skip_binder();
let this_decl_ty = tcx.type_of(this_fi.owner_id).subst_identity();
debug!(
"ClashingExternDeclarations: Comparing existing {:?}: {:?} to this {:?}: {:?}",
existing_did, existing_decl_ty, this_fi.owner_id, this_decl_ty