@@ -1509,21 +1509,21 @@ impl<'a> Parser<'a> {
1509
1509
}
1510
1510
} else if self . eat_keyword ( keywords:: Impl ) {
1511
1511
// Always parse bounds greedily for better error recovery.
1512
- let bounds = self . parse_ty_param_bounds ( ) ?;
1512
+ let bounds = self . parse_generic_bounds ( ) ?;
1513
1513
impl_dyn_multi = bounds. len ( ) > 1 || self . prev_token_kind == PrevTokenKind :: Plus ;
1514
1514
TyKind :: ImplTrait ( bounds)
1515
1515
} else if self . check_keyword ( keywords:: Dyn ) &&
1516
1516
self . look_ahead ( 1 , |t| t. can_begin_bound ( ) &&
1517
1517
!can_continue_type_after_non_fn_ident ( t) ) {
1518
1518
self . bump ( ) ; // `dyn`
1519
1519
// Always parse bounds greedily for better error recovery.
1520
- let bounds = self . parse_ty_param_bounds ( ) ?;
1520
+ let bounds = self . parse_generic_bounds ( ) ?;
1521
1521
impl_dyn_multi = bounds. len ( ) > 1 || self . prev_token_kind == PrevTokenKind :: Plus ;
1522
1522
TyKind :: TraitObject ( bounds, TraitObjectSyntax :: Dyn )
1523
1523
} else if self . check ( & token:: Question ) ||
1524
1524
self . check_lifetime ( ) && self . look_ahead ( 1 , |t| t. is_like_plus ( ) ) {
1525
1525
// Bound list (trait object type)
1526
- TyKind :: TraitObject ( self . parse_ty_param_bounds_common ( allow_plus) ?,
1526
+ TyKind :: TraitObject ( self . parse_generic_bounds_common ( allow_plus) ?,
1527
1527
TraitObjectSyntax :: None )
1528
1528
} else if self . eat_lt ( ) {
1529
1529
// Qualified path
@@ -1569,7 +1569,7 @@ impl<'a> Parser<'a> {
1569
1569
let mut bounds = vec ! [ GenericBound :: Trait ( poly_trait_ref, TraitBoundModifier :: None ) ] ;
1570
1570
if parse_plus {
1571
1571
self . eat_plus ( ) ; // `+`, or `+=` gets split and `+` is discarded
1572
- bounds. append ( & mut self . parse_ty_param_bounds ( ) ?) ;
1572
+ bounds. append ( & mut self . parse_generic_bounds ( ) ?) ;
1573
1573
}
1574
1574
Ok ( TyKind :: TraitObject ( bounds, TraitObjectSyntax :: None ) )
1575
1575
}
@@ -1594,7 +1594,7 @@ impl<'a> Parser<'a> {
1594
1594
}
1595
1595
1596
1596
self . bump ( ) ; // `+`
1597
- let bounds = self . parse_ty_param_bounds ( ) ?;
1597
+ let bounds = self . parse_generic_bounds ( ) ?;
1598
1598
let sum_span = ty. span . to ( self . prev_span ) ;
1599
1599
1600
1600
let mut err = struct_span_err ! ( self . sess. span_diagnostic, sum_span, E0178 ,
@@ -4735,7 +4735,7 @@ impl<'a> Parser<'a> {
4735
4735
// LT_BOUND = LIFETIME (e.g. `'a`)
4736
4736
// TY_BOUND = TY_BOUND_NOPAREN | (TY_BOUND_NOPAREN)
4737
4737
// TY_BOUND_NOPAREN = [?] [for<LT_PARAM_DEFS>] SIMPLE_PATH (e.g. `?for<'a: 'b> m::Trait<'a>`)
4738
- fn parse_ty_param_bounds_common ( & mut self , allow_plus : bool ) -> PResult < ' a , GenericBounds > {
4738
+ fn parse_generic_bounds_common ( & mut self , allow_plus : bool ) -> PResult < ' a , GenericBounds > {
4739
4739
let mut bounds = Vec :: new ( ) ;
4740
4740
loop {
4741
4741
// This needs to be syncronized with `Token::can_begin_bound`.
@@ -4784,8 +4784,8 @@ impl<'a> Parser<'a> {
4784
4784
return Ok ( bounds) ;
4785
4785
}
4786
4786
4787
- fn parse_ty_param_bounds ( & mut self ) -> PResult < ' a , GenericBounds > {
4788
- self . parse_ty_param_bounds_common ( true )
4787
+ fn parse_generic_bounds ( & mut self ) -> PResult < ' a , GenericBounds > {
4788
+ self . parse_generic_bounds_common ( true )
4789
4789
}
4790
4790
4791
4791
// Parse bounds of a lifetime parameter `BOUND + BOUND + BOUND`, possibly with trailing `+`.
@@ -4810,7 +4810,7 @@ impl<'a> Parser<'a> {
4810
4810
4811
4811
// Parse optional colon and param bounds.
4812
4812
let bounds = if self . eat ( & token:: Colon ) {
4813
- self . parse_ty_param_bounds ( ) ?
4813
+ self . parse_generic_bounds ( ) ?
4814
4814
} else {
4815
4815
Vec :: new ( )
4816
4816
} ;
@@ -4841,7 +4841,7 @@ impl<'a> Parser<'a> {
4841
4841
4842
4842
// Parse optional colon and param bounds.
4843
4843
let bounds = if self . eat ( & token:: Colon ) {
4844
- self . parse_ty_param_bounds ( ) ?
4844
+ self . parse_generic_bounds ( ) ?
4845
4845
} else {
4846
4846
Vec :: new ( )
4847
4847
} ;
@@ -5036,7 +5036,7 @@ impl<'a> Parser<'a> {
5036
5036
// or with mandatory equality sign and the second type.
5037
5037
let ty = self . parse_ty ( ) ?;
5038
5038
if self . eat ( & token:: Colon ) {
5039
- let bounds = self . parse_ty_param_bounds ( ) ?;
5039
+ let bounds = self . parse_generic_bounds ( ) ?;
5040
5040
where_clause. predicates . push ( ast:: WherePredicate :: BoundPredicate (
5041
5041
ast:: WhereBoundPredicate {
5042
5042
span : lo. to ( self . prev_span ) ,
@@ -5536,14 +5536,14 @@ impl<'a> Parser<'a> {
5536
5536
5537
5537
// Parse optional colon and supertrait bounds.
5538
5538
let bounds = if self . eat ( & token:: Colon ) {
5539
- self . parse_ty_param_bounds ( ) ?
5539
+ self . parse_generic_bounds ( ) ?
5540
5540
} else {
5541
5541
Vec :: new ( )
5542
5542
} ;
5543
5543
5544
5544
if self . eat ( & token:: Eq ) {
5545
5545
// it's a trait alias
5546
- let bounds = self . parse_ty_param_bounds ( ) ?;
5546
+ let bounds = self . parse_generic_bounds ( ) ?;
5547
5547
tps. where_clause = self . parse_where_clause ( ) ?;
5548
5548
self . expect ( & token:: Semi ) ?;
5549
5549
if unsafety != Unsafety :: Normal {
0 commit comments