@@ -929,6 +929,21 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
929
929
true
930
930
}
931
931
932
+ /// This helper takes a *converted* parameter type (`param_ty`)
933
+ /// and an *unconverted* list of bounds:
934
+ ///
935
+ /// ```
936
+ /// fn foo<T: Debug>
937
+ /// ^ ^^^^^ `ast_bounds` parameter, in HIR form
938
+ /// |
939
+ /// `param_ty`, in ty form
940
+ /// ```
941
+ ///
942
+ /// It adds these `ast_bounds` into the `bounds` structure.
943
+ ///
944
+ /// **A note on binders:** There is an implied binder around
945
+ /// `param_ty` and `ast_bounds`. See `instantiate_poly_trait_ref`
946
+ /// for more details.
932
947
fn add_bounds ( & self ,
933
948
param_ty : Ty < ' tcx > ,
934
949
ast_bounds : & [ hir:: GenericBound ] ,
@@ -962,9 +977,22 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
962
977
) ;
963
978
}
964
979
965
- /// Translates the AST's notion of ty param bounds (which are an enum consisting of a newtyped
966
- /// `Ty` or a region) to ty's notion of ty param bounds (which can either be user-defined traits
967
- /// or the built-in trait `Sized`).
980
+ /// Translates a list of bounds from the HIR into the `Bounds` data structure.
981
+ /// The self-type for the bounds is given by `param_ty`.
982
+ ///
983
+ /// Example:
984
+ ///
985
+ /// ```
986
+ /// fn foo<T: Bar + Baz>() { }
987
+ /// ^ ^^^^^^^^^ ast_bounds
988
+ /// param_ty
989
+ /// ```
990
+ ///
991
+ /// The `sized_by_default` parameter indicates if, in this context, the `param_ty` should be
992
+ /// considered `Sized` unless there is an explicit `?Sized` bound. This would be true in the
993
+ /// example above, but is not true in supertrait listings like `trait Foo: Bar + Baz`.
994
+ ///
995
+ /// `span` should be the declaration size of the parameter.
968
996
pub fn compute_bounds ( & self ,
969
997
param_ty : Ty < ' tcx > ,
970
998
ast_bounds : & [ hir:: GenericBound ] ,
0 commit comments