mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-28 20:16:58 +03:00
use check_path more
This commit is contained in:
@@ -919,7 +919,7 @@ fn parse_bottom_expr(&mut self) -> PResult<'a, P<Expr>> {
|
||||
} 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 @@ fn parse_item_kind(
|
||||
} 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 @@ fn is_pat_range_end_start(&self, dist: usize) -> bool {
|
||||
}
|
||||
|
||||
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 @@ fn parse_stmt_without_recovery(&mut self) -> PResult<'a, Option<Stmt>> {
|
||||
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 @@ fn parse_ty_common(
|
||||
// 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(;]
|
||||
|
||||
Reference in New Issue
Block a user