@@ -183,8 +183,13 @@ impl<'a> Parser<'a> {
183
183
}
184
184
}
185
185
186
- fn parse_remaining_bounds ( & mut self , generic_params : Vec < GenericParam > , path : ast:: Path ,
187
- lo : Span , parse_plus : bool ) -> PResult < ' a , TyKind > {
186
+ fn parse_remaining_bounds (
187
+ & mut self ,
188
+ generic_params : Vec < GenericParam > ,
189
+ path : ast:: Path ,
190
+ lo : Span ,
191
+ parse_plus : bool ,
192
+ ) -> PResult < ' a , TyKind > {
188
193
let poly_trait_ref = PolyTraitRef :: new ( generic_params, path, lo. to ( self . prev_span ) ) ;
189
194
let mut bounds = vec ! [ GenericBound :: Trait ( poly_trait_ref, TraitBoundModifier :: None ) ] ;
190
195
if parse_plus {
@@ -338,8 +343,10 @@ impl<'a> Parser<'a> {
338
343
. emit ( ) ;
339
344
}
340
345
341
- pub ( super ) fn parse_generic_bounds ( & mut self ,
342
- colon_span : Option < Span > ) -> PResult < ' a , GenericBounds > {
346
+ pub ( super ) fn parse_generic_bounds (
347
+ & mut self ,
348
+ colon_span : Option < Span > ,
349
+ ) -> PResult < ' a , GenericBounds > {
343
350
self . parse_generic_bounds_common ( true , colon_span)
344
351
}
345
352
@@ -351,20 +358,24 @@ impl<'a> Parser<'a> {
351
358
/// TY_BOUND = TY_BOUND_NOPAREN | (TY_BOUND_NOPAREN)
352
359
/// TY_BOUND_NOPAREN = [?] [for<LT_PARAM_DEFS>] SIMPLE_PATH (e.g., `?for<'a: 'b> m::Trait<'a>`)
353
360
/// ```
354
- fn parse_generic_bounds_common ( & mut self ,
355
- allow_plus : bool ,
356
- colon_span : Option < Span > ) -> PResult < ' a , GenericBounds > {
361
+ fn parse_generic_bounds_common (
362
+ & mut self ,
363
+ allow_plus : bool ,
364
+ colon_span : Option < Span > ,
365
+ ) -> PResult < ' a , GenericBounds > {
357
366
let mut bounds = Vec :: new ( ) ;
358
367
let mut negative_bounds = Vec :: new ( ) ;
359
368
let mut last_plus_span = None ;
360
369
let mut was_negative = false ;
361
370
loop {
362
371
// This needs to be synchronized with `TokenKind::can_begin_bound`.
363
- let is_bound_start = self . check_path ( ) || self . check_lifetime ( ) ||
364
- self . check ( & token:: Not ) || // used for error reporting only
365
- self . check ( & token:: Question ) ||
366
- self . check_keyword ( kw:: For ) ||
367
- self . check ( & token:: OpenDelim ( token:: Paren ) ) ;
372
+ let is_bound_start = self . check_path ( )
373
+ || self . check_lifetime ( )
374
+ || self . check ( & token:: Not ) // Used for error reporting only.
375
+ || self . check ( & token:: Question )
376
+ || self . check_keyword ( kw:: For )
377
+ || self . check ( & token:: OpenDelim ( token:: Paren ) ) ;
378
+
368
379
if is_bound_start {
369
380
let lo = self . token . span ;
370
381
let has_parens = self . eat ( & token:: OpenDelim ( token:: Paren ) ) ;
0 commit comments