Skip to content

Commit b27dc6b

Browse files
fixup! rustc_parser: consider the in 2024 an expression
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
1 parent 88750c3 commit b27dc6b

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

compiler/rustc_parse/src/parser/nonterminal.rs

-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ impl<'a> Parser<'a> {
4444
&& !token.is_keyword(kw::Let)
4545
// This exception is here for backwards compatibility.
4646
&& !token.is_keyword(kw::Const)
47-
// FIXME(vincenzopalazzo): query less time the edition
48-
&& (token.span.edition().at_least_rust_2024() && !token.is_keyword(kw::Underscore) )
4947
}
5048
NonterminalKind::Expr(Expr) => {
5149
token.can_begin_expr()

tests/ui/macros/expr_2024_underscore_expr.edi2021.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: no rules expected the token `_`
2-
--> $DIR/expr_2024_underscore_expr.rs:23:12
2+
--> $DIR/expr_2024_underscore_expr.rs:22:12
33
|
44
LL | macro_rules! m2021 {
55
| ------------------ when calling this macro
@@ -8,13 +8,13 @@ LL | m2021!(_);
88
| ^ no rules expected this token in macro call
99
|
1010
note: while trying to match meta-variable `$e:expr_2021`
11-
--> $DIR/expr_2024_underscore_expr.rs:11:6
11+
--> $DIR/expr_2024_underscore_expr.rs:10:6
1212
|
1313
LL | ($e:expr_2021) => {
1414
| ^^^^^^^^^^^^
1515

1616
error: no rules expected the token `_`
17-
--> $DIR/expr_2024_underscore_expr.rs:24:12
17+
--> $DIR/expr_2024_underscore_expr.rs:23:12
1818
|
1919
LL | macro_rules! m2024 {
2020
| ------------------ when calling this macro
@@ -23,7 +23,7 @@ LL | m2024!(_);
2323
| ^ no rules expected this token in macro call
2424
|
2525
note: while trying to match meta-variable `$e:expr`
26-
--> $DIR/expr_2024_underscore_expr.rs:17:6
26+
--> $DIR/expr_2024_underscore_expr.rs:16:6
2727
|
2828
LL | ($e:expr) => {
2929
| ^^^^^^^

0 commit comments

Comments
 (0)