@@ -888,10 +888,10 @@ impl<'a> Parser<'a> {
888888 }
889889 _ => {
890890 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+ } )
895895 }
896896 }
897897 }
@@ -2039,8 +2039,8 @@ impl<'a> Parser<'a> {
20392039 path = self . parse_path ( PathStyle :: Type ) ?;
20402040 path_span = path_lo. to ( self . prev_span ) ;
20412041 } else {
2042- path = ast:: Path { segments : Vec :: new ( ) , span : syntax_pos:: DUMMY_SP } ;
20432042 path_span = self . span . to ( self . span ) ;
2043+ path = ast:: Path { segments : Vec :: new ( ) , span : path_span } ;
20442044 }
20452045
20462046 // See doc comment for `unmatched_angle_bracket_count`.
@@ -3357,7 +3357,11 @@ impl<'a> Parser<'a> {
33573357 // want to keep their span info to improve diagnostics in these cases in a later stage.
33583358 ( true , Some ( AssocOp :: Multiply ) ) | // `{ 42 } *foo = bar;` or `{ 42 } * 3`
33593359 ( 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 ( ) ) => {
33613365 // These cases are ambiguous and can't be identified in the parser alone
33623366 let sp = self . sess . source_map ( ) . start_point ( self . span ) ;
33633367 self . sess . ambiguous_block_expr_parse . borrow_mut ( ) . insert ( sp, lhs. span ) ;
@@ -5848,7 +5852,7 @@ impl<'a> Parser<'a> {
58485852 let mut where_clause = WhereClause {
58495853 id : ast:: DUMMY_NODE_ID ,
58505854 predicates : Vec :: new ( ) ,
5851- span : syntax_pos :: DUMMY_SP ,
5855+ span : self . prev_span . to ( self . prev_span ) ,
58525856 } ;
58535857
58545858 if !self . eat_keyword ( keywords:: Where ) {
0 commit comments