@@ -699,6 +699,15 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
699
699
} ,
700
700
) ;
701
701
702
+ // Convert associated-type bindings or constraints into a separate vector.
703
+ // Example: Given this:
704
+ //
705
+ // T: Iterator<Item = u32>
706
+ //
707
+ // The `T` is passed in as a self-type; the `Item = u32` is
708
+ // not a "type parameter" of the `Iterator` trait, but rather
709
+ // a restriction on `<T as Iterator>::Item`, so it is passed
710
+ // back separately.
702
711
let assoc_bindings = generic_args. bindings . iter ( )
703
712
. map ( |binding| {
704
713
let kind = if let hir:: TyKind :: AssocTyExistential ( ref bounds) = binding. ty . node {
@@ -899,7 +908,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
899
908
true
900
909
}
901
910
902
- pub fn add_bounds ( & self ,
911
+ fn add_bounds ( & self ,
903
912
param_ty : Ty < ' tcx > ,
904
913
ast_bounds : & [ hir:: GenericBound ] ,
905
914
bounds : & mut Bounds < ' tcx > ,
@@ -1065,6 +1074,10 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
1065
1074
1066
1075
match binding. kind {
1067
1076
ConvertedBindingKind :: Equality ( ref ty) => {
1077
+ // "Desugar" a constraint like `T: Iterator<Item = u32>` this to
1078
+ // the "projection predicate" for:
1079
+ //
1080
+ // `<T as Iterator>::Item = u32`
1068
1081
bounds. projection_bounds . push ( ( candidate. map_bound ( |trait_ref| {
1069
1082
ty:: ProjectionPredicate {
1070
1083
projection_ty : ty:: ProjectionTy :: from_ref_and_name (
0 commit comments