@@ -376,42 +376,42 @@ impl<'a> Parser<'a> {
376376 || self . check_keyword ( kw:: For )
377377 || self . check ( & token:: OpenDelim ( token:: Paren ) ) ;
378378
379- if is_bound_start {
380- let lo = self . token . span ;
381- let has_parens = self . eat ( & token:: OpenDelim ( token:: Paren ) ) ;
382- let inner_lo = self . token . span ;
383- let is_negative = self . eat ( & token:: Not ) ;
384- let question = if self . eat ( & token:: Question ) { Some ( self . prev_span ) } else { None } ;
385- if self . token . is_lifetime ( ) {
386- self . error_opt_out_lifetime ( question) ;
387- bounds. push ( GenericBound :: Outlives ( self . expect_lifetime ( ) ) ) ;
388- if has_parens {
389- self . recover_paren_lifetime ( lo, inner_lo) ?;
379+ if !is_bound_start {
380+ break ;
381+ }
382+
383+ let lo = self . token . span ;
384+ let has_parens = self . eat ( & token:: OpenDelim ( token:: Paren ) ) ;
385+ let inner_lo = self . token . span ;
386+ let is_negative = self . eat ( & token:: Not ) ;
387+ let question = if self . eat ( & token:: Question ) { Some ( self . prev_span ) } else { None } ;
388+ if self . token . is_lifetime ( ) {
389+ self . error_opt_out_lifetime ( question) ;
390+ bounds. push ( GenericBound :: Outlives ( self . expect_lifetime ( ) ) ) ;
391+ if has_parens {
392+ self . recover_paren_lifetime ( lo, inner_lo) ?;
393+ }
394+ } else {
395+ let lifetime_defs = self . parse_late_bound_lifetime_defs ( ) ?;
396+ let path = self . parse_path ( PathStyle :: Type ) ?;
397+ if has_parens {
398+ self . expect ( & token:: CloseDelim ( token:: Paren ) ) ?;
399+ }
400+ let poly_span = lo. to ( self . prev_span ) ;
401+ if is_negative {
402+ was_negative = true ;
403+ if let Some ( sp) = last_plus_span. or ( colon_span) {
404+ negative_bounds. push ( sp. to ( poly_span) ) ;
390405 }
391406 } else {
392- let lifetime_defs = self . parse_late_bound_lifetime_defs ( ) ?;
393- let path = self . parse_path ( PathStyle :: Type ) ?;
394- if has_parens {
395- self . expect ( & token:: CloseDelim ( token:: Paren ) ) ?;
396- }
397- let poly_span = lo. to ( self . prev_span ) ;
398- if is_negative {
399- was_negative = true ;
400- if let Some ( sp) = last_plus_span. or ( colon_span) {
401- negative_bounds. push ( sp. to ( poly_span) ) ;
402- }
407+ let poly_trait = PolyTraitRef :: new ( lifetime_defs, path, poly_span) ;
408+ let modifier = if question. is_some ( ) {
409+ TraitBoundModifier :: Maybe
403410 } else {
404- let poly_trait = PolyTraitRef :: new ( lifetime_defs, path, poly_span) ;
405- let modifier = if question. is_some ( ) {
406- TraitBoundModifier :: Maybe
407- } else {
408- TraitBoundModifier :: None
409- } ;
410- bounds. push ( GenericBound :: Trait ( poly_trait, modifier) ) ;
411- }
411+ TraitBoundModifier :: None
412+ } ;
413+ bounds. push ( GenericBound :: Trait ( poly_trait, modifier) ) ;
412414 }
413- } else {
414- break
415415 }
416416
417417 if !allow_plus || !self . eat_plus ( ) {
0 commit comments