@@ -8,7 +8,7 @@ use crate::DirectoryOwnership;
8
8
9
9
use rustc_errors:: { Applicability , PResult } ;
10
10
use rustc_span:: source_map:: { BytePos , Span } ;
11
- use rustc_span:: symbol:: { kw, sym, Symbol } ;
11
+ use rustc_span:: symbol:: { kw, sym} ;
12
12
use syntax:: ast;
13
13
use syntax:: ast:: { AttrStyle , AttrVec , Attribute , Mac , MacStmtStyle } ;
14
14
use syntax:: ast:: { Block , BlockCheckMode , Expr , ExprKind , Local , Stmt , StmtKind , DUMMY_NODE_ID } ;
@@ -55,13 +55,11 @@ impl<'a> Parser<'a> {
55
55
return self . recover_stmt_local ( lo, attrs. into ( ) , msg, "let" ) ;
56
56
}
57
57
58
- // Starts like a simple path, being careful to avoid contextual keywords
59
- // such as a union items, item with `crate` visibility or auto trait items.
60
- // Our goal here is to parse an arbitrary path `a::b::c` but not something that starts
61
- // like a path (1 token), but it fact not a path.
62
- if self . token . is_path_start ( )
63
- && !self . token . is_qpath_start ( )
64
- && !self . is_path_start_item ( ) // Confirm we don't steal syntax from `parse_item_`.
58
+ // Starts like a simple path, being careful to avoid contextual keywords,
59
+ // e.g., `union`, items with `crate` visibility, or `auto trait` items.
60
+ // We aim to parse an arbitrary path `a::b` but not something that starts like a path
61
+ // (1 token), but it fact not a path. Also, we avoid stealing syntax from `parse_item_`.
62
+ if self . token . is_path_start ( ) && !self . token . is_qpath_start ( ) && !self . is_path_start_item ( )
65
63
{
66
64
let path = self . parse_path ( PathStyle :: Expr ) ?;
67
65
@@ -191,10 +189,6 @@ impl<'a> Parser<'a> {
191
189
}
192
190
}
193
191
194
- fn is_kw_followed_by_ident ( & self , kw : Symbol ) -> bool {
195
- self . token . is_keyword ( kw) && self . look_ahead ( 1 , |t| t. is_ident ( ) && !t. is_reserved_ident ( ) )
196
- }
197
-
198
192
fn recover_stmt_local (
199
193
& mut self ,
200
194
lo : Span ,
0 commit comments