@@ -75,7 +75,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP
7575
7676 const NO_GENERICS : & hir:: Generics < ' _ > = hir:: Generics :: empty ( ) ;
7777
78- // We use an `IndexSet` to preserves order of insertion.
78+ // We use an `IndexSet` to preserve order of insertion.
7979 // Preserving the order of insertion is important here so as not to break UI tests.
8080 let mut predicates: FxIndexSet < ( ty:: Predicate < ' _ > , Span ) > = FxIndexSet :: default ( ) ;
8181
@@ -97,11 +97,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP
9797 | ItemKind :: Struct ( _, ref generics)
9898 | ItemKind :: Union ( _, ref generics) => * generics,
9999
100- ItemKind :: Trait ( _, _, ref generics, ..) => {
101- is_trait = Some ( ty:: TraitRef :: identity ( tcx, def_id) ) ;
102- * generics
103- }
104- ItemKind :: TraitAlias ( ref generics, _) => {
100+ ItemKind :: Trait ( _, _, ref generics, ..) | ItemKind :: TraitAlias ( ref generics, _) => {
105101 is_trait = Some ( ty:: TraitRef :: identity ( tcx, def_id) ) ;
106102 * generics
107103 }
@@ -406,9 +402,10 @@ pub(super) fn explicit_predicates_of<'tcx>(
406402 // For a predicate from a where clause to become a bound on an
407403 // associated type:
408404 // * It must use the identity substs of the item.
409- // * Since any generic parameters on the item are not in scope,
410- // this means that the item is not a GAT, and its identity
411- // substs are the same as the trait's.
405+ // * We're in the scope of the trait, so we can't name any
406+ // parameters of the GAT. That means that all we need to
407+ // check are that the substs of the projection are the
408+ // identity substs of the trait.
412409 // * It must be an associated type for this trait (*not* a
413410 // supertrait).
414411 if let ty:: Projection ( projection) = ty. kind ( ) {
0 commit comments