@@ -888,10 +888,10 @@ impl<'a> Parser<'a> {
888
888
}
889
889
_ => {
890
890
Err ( if self . prev_token_kind == PrevTokenKind :: DocComment {
891
- self . span_fatal_err ( self . prev_span , Error :: UselessDocComment )
892
- } else {
893
- self . expected_ident_found ( )
894
- } )
891
+ self . span_fatal_err ( self . prev_span , Error :: UselessDocComment )
892
+ } else {
893
+ self . expected_ident_found ( )
894
+ } )
895
895
}
896
896
}
897
897
}
@@ -2039,8 +2039,8 @@ impl<'a> Parser<'a> {
2039
2039
path = self . parse_path ( PathStyle :: Type ) ?;
2040
2040
path_span = path_lo. to ( self . prev_span ) ;
2041
2041
} else {
2042
- path = ast:: Path { segments : Vec :: new ( ) , span : syntax_pos:: DUMMY_SP } ;
2043
2042
path_span = self . span . to ( self . span ) ;
2043
+ path = ast:: Path { segments : Vec :: new ( ) , span : path_span } ;
2044
2044
}
2045
2045
2046
2046
// See doc comment for `unmatched_angle_bracket_count`.
@@ -3357,7 +3357,11 @@ impl<'a> Parser<'a> {
3357
3357
// want to keep their span info to improve diagnostics in these cases in a later stage.
3358
3358
( true , Some ( AssocOp :: Multiply ) ) | // `{ 42 } *foo = bar;` or `{ 42 } * 3`
3359
3359
( true , Some ( AssocOp :: Subtract ) ) | // `{ 42 } -5`
3360
- ( true , Some ( AssocOp :: Add ) ) => { // `{ 42 } + 42
3360
+ ( true , Some ( AssocOp :: LAnd ) ) | // `{ 42 } &&x` (#61475)
3361
+ ( true , Some ( AssocOp :: Add ) ) // `{ 42 } + 42
3362
+ // If the next token is a keyword, then the tokens above *are* unambiguously incorrect:
3363
+ // `if x { a } else { b } && if y { c } else { d }`
3364
+ if !self . look_ahead ( 1 , |t| t. is_reserved_ident ( ) ) => {
3361
3365
// These cases are ambiguous and can't be identified in the parser alone
3362
3366
let sp = self . sess . source_map ( ) . start_point ( self . span ) ;
3363
3367
self . sess . ambiguous_block_expr_parse . borrow_mut ( ) . insert ( sp, lhs. span ) ;
@@ -5848,7 +5852,7 @@ impl<'a> Parser<'a> {
5848
5852
let mut where_clause = WhereClause {
5849
5853
id : ast:: DUMMY_NODE_ID ,
5850
5854
predicates : Vec :: new ( ) ,
5851
- span : syntax_pos :: DUMMY_SP ,
5855
+ span : self . prev_span . to ( self . prev_span ) ,
5852
5856
} ;
5853
5857
5854
5858
if !self . eat_keyword ( keywords:: Where ) {
0 commit comments