@@ -293,8 +293,6 @@ pub(super) fn check_item<'tcx>(
293293 hir::ItemKind::Struct(..) => check_type_defn(tcx, item, false),
294294 hir::ItemKind::Union(..) => check_type_defn(tcx, item, true),
295295 hir::ItemKind::Enum(..) => check_type_defn(tcx, item, true),
296- hir::ItemKind::Trait(..) => check_trait(tcx, item),
297- hir::ItemKind::TraitAlias(..) => check_trait(tcx, item),
298296 _ => Ok(()),
299297 }
300298}
@@ -345,7 +343,7 @@ pub(crate) fn check_trait_item<'tcx>(
345343/// fn into_iter<'a>(&'a self) -> Self::Iter<'a>;
346344/// }
347345/// ```
348- fn check_gat_where_clauses(tcx: TyCtxt<'_>, trait_def_id: LocalDefId) {
346+ pub(crate) fn check_gat_where_clauses(tcx: TyCtxt<'_>, trait_def_id: LocalDefId) {
349347 // Associates every GAT's def_id to a list of possibly missing bounds detected by this lint.
350348 let mut required_bounds_by_item = FxIndexMap::default();
351349 let associated_items = tcx.associated_items(trait_def_id);
@@ -1106,11 +1104,8 @@ fn check_type_defn<'tcx>(
11061104 })
11071105}
11081106
1109- #[instrument(skip(tcx, item))]
1110- fn check_trait(tcx: TyCtxt<'_>, item: &hir::Item<'_>) -> Result<(), ErrorGuaranteed> {
1111- debug!(?item.owner_id);
1112-
1113- let def_id = item.owner_id.def_id;
1107+ #[instrument(skip(tcx))]
1108+ pub(crate) fn check_trait(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), ErrorGuaranteed> {
11141109 if tcx.is_lang_item(def_id.into(), LangItem::PointeeSized) {
11151110 // `PointeeSized` is removed during lowering.
11161111 return Ok(());
@@ -1136,10 +1131,6 @@ fn check_trait(tcx: TyCtxt<'_>, item: &hir::Item<'_>) -> Result<(), ErrorGuarant
11361131 Ok(())
11371132 });
11381133
1139- // Only check traits, don't check trait aliases
1140- if let hir::ItemKind::Trait(..) = item.kind {
1141- check_gat_where_clauses(tcx, item.owner_id.def_id);
1142- }
11431134 res
11441135}
11451136
0 commit comments