@@ -305,8 +305,13 @@ impl<'a> Parser<'a> {
305305 let removal_span = kw. span . with_hi ( self . token . span . lo ( ) ) ;
306306 let path = self . parse_path ( PathStyle :: Type ) ?;
307307 let parse_plus = allow_plus == AllowPlus :: Yes && self . check_plus ( ) ;
308- let kind =
309- self . parse_remaining_bounds_path ( lifetime_defs, path, lo, parse_plus) ?;
308+ let kind = self . parse_remaining_bounds_path (
309+ lifetime_defs,
310+ path,
311+ lo,
312+ parse_plus,
313+ false ,
314+ ) ?;
310315 let err = self . dcx ( ) . create_err ( errors:: TransposeDynOrImpl {
311316 span : kw. span ,
312317 kw : kw. name . as_str ( ) ,
@@ -333,7 +338,7 @@ impl<'a> Parser<'a> {
333338 } else {
334339 let path = self . parse_path ( PathStyle :: Type ) ?;
335340 let parse_plus = allow_plus == AllowPlus :: Yes && self . check_plus ( ) ;
336- self . parse_remaining_bounds_path ( lifetime_defs, path, lo, parse_plus) ?
341+ self . parse_remaining_bounds_path ( lifetime_defs, path, lo, parse_plus, false ) ?
337342 }
338343 }
339344 } else if self . eat_keyword ( exp ! ( Impl ) ) {
@@ -414,7 +419,7 @@ impl<'a> Parser<'a> {
414419 match ty. kind {
415420 // `(TY_BOUND_NOPAREN) + BOUND + ...`.
416421 TyKind :: Path ( None , path) if maybe_bounds => {
417- self . parse_remaining_bounds_path ( ThinVec :: new ( ) , path, lo, true )
422+ self . parse_remaining_bounds_path ( ThinVec :: new ( ) , path, lo, true , true )
418423 }
419424 // For `('a) + …`, we know that `'a` in type position already lead to an error being
420425 // emitted. To reduce output, let's indirectly suppress E0178 (bad `+` in type) and
@@ -495,12 +500,14 @@ impl<'a> Parser<'a> {
495500 path : ast:: Path ,
496501 lo : Span ,
497502 parse_plus : bool ,
503+ has_parens : bool ,
498504 ) -> PResult < ' a , TyKind > {
499505 let poly_trait_ref = PolyTraitRef :: new (
500506 generic_params,
501507 path,
502508 TraitBoundModifiers :: NONE ,
503509 lo. to ( self . prev_token . span ) ,
510+ has_parens,
504511 ) ;
505512 let bounds = vec ! [ GenericBound :: Trait ( poly_trait_ref) ] ;
506513 self . parse_remaining_bounds ( bounds, parse_plus)
@@ -832,7 +839,7 @@ impl<'a> Parser<'a> {
832839 Ok ( TyKind :: MacCall ( P ( MacCall { path, args : self . parse_delim_args ( ) ? } ) ) )
833840 } else if allow_plus == AllowPlus :: Yes && self . check_plus ( ) {
834841 // `Trait1 + Trait2 + 'a`
835- self . parse_remaining_bounds_path ( ThinVec :: new ( ) , path, lo, true )
842+ self . parse_remaining_bounds_path ( ThinVec :: new ( ) , path, lo, true , false )
836843 } else {
837844 // Just a type path.
838845 Ok ( TyKind :: Path ( None , path) )
@@ -1190,8 +1197,13 @@ impl<'a> Parser<'a> {
11901197 }
11911198 }
11921199
1193- let poly_trait =
1194- PolyTraitRef :: new ( lifetime_defs, path, modifiers, lo. to ( self . prev_token . span ) ) ;
1200+ let poly_trait = PolyTraitRef :: new (
1201+ lifetime_defs,
1202+ path,
1203+ modifiers,
1204+ lo. to ( self . prev_token . span ) ,
1205+ has_parens,
1206+ ) ;
11951207 Ok ( GenericBound :: Trait ( poly_trait) )
11961208 }
11971209
0 commit comments