Skip to content

Commit

Permalink
fixup! rustc_parser: consider the in 2024 an expression
Browse files Browse the repository at this point in the history
Signed-off-by: Vincenzo Palazzo <[email protected]>
  • Loading branch information
vincenzopalazzo committed Jul 26, 2024
1 parent 88750c3 commit b27dc6b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 0 additions & 2 deletions compiler/rustc_parse/src/parser/nonterminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ impl<'a> Parser<'a> {
&& !token.is_keyword(kw::Let)
// This exception is here for backwards compatibility.
&& !token.is_keyword(kw::Const)
// FIXME(vincenzopalazzo): query less time the edition
&& (token.span.edition().at_least_rust_2024() && !token.is_keyword(kw::Underscore) )
}
NonterminalKind::Expr(Expr) => {
token.can_begin_expr()
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/macros/expr_2024_underscore_expr.edi2021.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: no rules expected the token `_`
--> $DIR/expr_2024_underscore_expr.rs:23:12
--> $DIR/expr_2024_underscore_expr.rs:22:12
|
LL | macro_rules! m2021 {
| ------------------ when calling this macro
Expand All @@ -8,13 +8,13 @@ LL | m2021!(_);
| ^ no rules expected this token in macro call
|
note: while trying to match meta-variable `$e:expr_2021`
--> $DIR/expr_2024_underscore_expr.rs:11:6
--> $DIR/expr_2024_underscore_expr.rs:10:6
|
LL | ($e:expr_2021) => {
| ^^^^^^^^^^^^

error: no rules expected the token `_`
--> $DIR/expr_2024_underscore_expr.rs:24:12
--> $DIR/expr_2024_underscore_expr.rs:23:12
|
LL | macro_rules! m2024 {
| ------------------ when calling this macro
Expand All @@ -23,7 +23,7 @@ LL | m2024!(_);
| ^ no rules expected this token in macro call
|
note: while trying to match meta-variable `$e:expr`
--> $DIR/expr_2024_underscore_expr.rs:17:6
--> $DIR/expr_2024_underscore_expr.rs:16:6
|
LL | ($e:expr) => {
| ^^^^^^^
Expand Down

0 comments on commit b27dc6b

Please sign in to comment.