@@ -75,7 +75,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP
75
75
76
76
const NO_GENERICS : & hir:: Generics < ' _ > = hir:: Generics :: empty ( ) ;
77
77
78
- // We use an `IndexSet` to preserves order of insertion.
78
+ // We use an `IndexSet` to preserve order of insertion.
79
79
// Preserving the order of insertion is important here so as not to break UI tests.
80
80
let mut predicates: FxIndexSet < ( ty:: Predicate < ' _ > , Span ) > = FxIndexSet :: default ( ) ;
81
81
@@ -97,11 +97,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP
97
97
| ItemKind :: Struct ( _, ref generics)
98
98
| ItemKind :: Union ( _, ref generics) => * generics,
99
99
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, _) => {
105
101
is_trait = Some ( ty:: TraitRef :: identity ( tcx, def_id) ) ;
106
102
* generics
107
103
}
@@ -406,9 +402,10 @@ pub(super) fn explicit_predicates_of<'tcx>(
406
402
// For a predicate from a where clause to become a bound on an
407
403
// associated type:
408
404
// * 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.
412
409
// * It must be an associated type for this trait (*not* a
413
410
// supertrait).
414
411
if let ty:: Projection ( projection) = ty. kind ( ) {
0 commit comments