use check_path more
This commit is contained in:
parent
c0b073bc62
commit
d1822b3dcf
6 changed files with 6 additions and 9 deletions
|
|
@ -919,7 +919,7 @@ impl<'a> Parser<'a> {
|
|||
} else if self.eat_lt() {
|
||||
let (qself, path) = self.parse_qpath(PathStyle::Expr)?;
|
||||
Ok(self.mk_expr(lo.to(path.span), ExprKind::Path(Some(qself), path), attrs))
|
||||
} else if self.token.is_path_start() {
|
||||
} else if self.check_path() {
|
||||
self.parse_path_start_expr(attrs)
|
||||
} else if self.check_keyword(kw::Move) || self.check_keyword(kw::Static) {
|
||||
self.parse_closure_expr(attrs)
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ impl<'a> Parser<'a> {
|
|||
} else if vis.node.is_pub() && self.isnt_macro_invocation() {
|
||||
self.recover_missing_kw_before_item()?;
|
||||
return Ok(None);
|
||||
} else if macros_allowed && self.token.is_path_start() {
|
||||
} else if macros_allowed && self.check_path() {
|
||||
// MACRO INVOCATION ITEM
|
||||
(Ident::invalid(), ItemKind::Mac(self.parse_item_macro(vis)?))
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -704,7 +704,7 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
|
||||
fn parse_pat_range_end(&mut self) -> PResult<'a, P<Expr>> {
|
||||
if self.token.is_path_start() {
|
||||
if self.check_path() {
|
||||
let lo = self.token.span;
|
||||
let (qself, path) = if self.eat_lt() {
|
||||
// Parse a qualified path
|
||||
|
|
|
|||
|
|
@ -48,10 +48,7 @@ impl<'a> Parser<'a> {
|
|||
self.bump(); // `var`
|
||||
let msg = "write `let` instead of `var` to introduce a new variable";
|
||||
self.recover_stmt_local(lo, attrs.into(), msg, "let")?
|
||||
} else if self.token.is_path_start()
|
||||
&& !self.token.is_qpath_start()
|
||||
&& !self.is_path_start_item()
|
||||
{
|
||||
} else if self.check_path() && !self.token.is_qpath_start() && !self.is_path_start_item() {
|
||||
// We have avoided contextual keywords like `union`, items with `crate` visibility,
|
||||
// or `auto trait` items. We aim to parse an arbitrary path `a::b` but not something
|
||||
// that starts like a path (1 token), but it fact not a path.
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ impl<'a> Parser<'a> {
|
|||
// Qualified path
|
||||
let (qself, path) = self.parse_qpath(PathStyle::Type)?;
|
||||
TyKind::Path(Some(qself), path)
|
||||
} else if self.token.is_path_start() {
|
||||
} else if self.check_path() {
|
||||
self.parse_path_start_ty(lo, allow_plus)?
|
||||
} else if self.eat(&token::DotDotDot) {
|
||||
if allow_c_variadic == AllowCVariadic::Yes {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ error: expected one of `!`, `(`, `)`, `+`, `,`, `::`, or `<`, found `;`
|
|||
LL | impl W <s(f;Y(;]
|
||||
| ^ expected one of 7 possible tokens
|
||||
|
||||
error: expected one of `!`, `&&`, `&`, `(`, `)`, `*`, `+`, `,`, `->`, `...`, `::`, `<`, `>`, `?`, `[`, `_`, `dyn`, `extern`, `fn`, `for`, `impl`, `unsafe`, or lifetime, found `;`
|
||||
error: expected one of `!`, `&&`, `&`, `(`, `)`, `*`, `+`, `,`, `->`, `...`, `::`, `<`, `>`, `?`, `[`, `_`, `dyn`, `extern`, `fn`, `for`, `impl`, `unsafe`, lifetime, or path, found `;`
|
||||
--> $DIR/issue-63116.rs:3:15
|
||||
|
|
||||
LL | impl W <s(f;Y(;]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue