@@ -628,10 +628,10 @@ impl<'a> Parser<'a> {
628
628
}
629
629
_ => {
630
630
Err ( if self . prev_token_kind == PrevTokenKind :: DocComment {
631
- self . span_fatal_err ( self . prev_span , Error :: UselessDocComment )
632
- } else {
633
- self . expected_ident_found ( )
634
- } )
631
+ self . span_fatal_err ( self . prev_span , Error :: UselessDocComment )
632
+ } else {
633
+ self . expected_ident_found ( )
634
+ } )
635
635
}
636
636
}
637
637
}
@@ -1657,8 +1657,8 @@ impl<'a> Parser<'a> {
1657
1657
path = self . parse_path ( PathStyle :: Type ) ?;
1658
1658
path_span = path_lo. to ( self . prev_span ) ;
1659
1659
} else {
1660
- path = ast:: Path { segments : Vec :: new ( ) , span : DUMMY_SP } ;
1661
1660
path_span = self . span . to ( self . span ) ;
1661
+ path = ast:: Path { segments : Vec :: new ( ) , span : path_span } ;
1662
1662
}
1663
1663
1664
1664
// See doc comment for `unmatched_angle_bracket_count`.
@@ -2844,7 +2844,11 @@ impl<'a> Parser<'a> {
2844
2844
// want to keep their span info to improve diagnostics in these cases in a later stage.
2845
2845
( true , Some ( AssocOp :: Multiply ) ) | // `{ 42 } *foo = bar;` or `{ 42 } * 3`
2846
2846
( true , Some ( AssocOp :: Subtract ) ) | // `{ 42 } -5`
2847
- ( true , Some ( AssocOp :: Add ) ) => { // `{ 42 } + 42
2847
+ ( true , Some ( AssocOp :: LAnd ) ) | // `{ 42 } &&x` (#61475)
2848
+ ( true , Some ( AssocOp :: Add ) ) // `{ 42 } + 42
2849
+ // If the next token is a keyword, then the tokens above *are* unambiguously incorrect:
2850
+ // `if x { a } else { b } && if y { c } else { d }`
2851
+ if !self . look_ahead ( 1 , |t| t. is_reserved_ident ( ) ) => {
2848
2852
// These cases are ambiguous and can't be identified in the parser alone
2849
2853
let sp = self . sess . source_map ( ) . start_point ( self . span ) ;
2850
2854
self . sess . ambiguous_block_expr_parse . borrow_mut ( ) . insert ( sp, lhs. span ) ;
@@ -5298,7 +5302,7 @@ impl<'a> Parser<'a> {
5298
5302
let mut where_clause = WhereClause {
5299
5303
id : ast:: DUMMY_NODE_ID ,
5300
5304
predicates : Vec :: new ( ) ,
5301
- span : DUMMY_SP ,
5305
+ span : self . prev_span . to ( self . prev_span ) ,
5302
5306
} ;
5303
5307
5304
5308
if !self . eat_keyword ( kw:: Where ) {
0 commit comments