Skip to content

Commit 50a46b9

Browse files
committed
use feature_err to report unstable expr_2021
1 parent 0d43437 commit 50a46b9

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

compiler/rustc_expand/messages.ftl

-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ expand_explain_doc_comment_inner =
4242
expand_explain_doc_comment_outer =
4343
outer doc comments expand to `#[doc = "..."]`, which is what this macro attempted to match
4444
45-
expand_expr_2021_is_experimental =
46-
expr_2021 is experimental
47-
4845
expand_expr_repeat_no_syntax_vars =
4946
attempted to repeat an expression containing no syntax variables matched as repeating at this depth
5047

compiler/rustc_expand/src/errors.rs

-7
Original file line numberDiff line numberDiff line change
@@ -456,10 +456,3 @@ pub struct ExpectedParenOrBrace<'a> {
456456
pub span: Span,
457457
pub token: Cow<'a, str>,
458458
}
459-
460-
#[derive(Diagnostic)]
461-
#[diag(expand_expr_2021_is_experimental)]
462-
pub struct Expr2021IsExperimental {
463-
#[primary_span]
464-
pub span: Span,
465-
}

compiler/rustc_expand/src/mbe/quoted.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,13 @@ pub(super) fn parse(
9595
if kind == token::NonterminalKind::Expr2021
9696
&& !features.expr_fragment_specifier_2024
9797
{
98-
sess.dcx()
99-
.emit_err(errors::Expr2021IsExperimental { span });
98+
rustc_session::parse::feature_err(
99+
sess,
100+
sym::expr_fragment_specifier_2024,
101+
span,
102+
"fragment specifier `expr_2021` is unstable",
103+
)
104+
.emit();
100105
}
101106
result.push(TokenTree::MetaVarDecl(span, ident, Some(kind)));
102107
continue;

tests/ui/macros/feature-gate-expr_fragment_specifier_2024.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@ compile-flags: --edition=2024 -Z unstable-options
22

33
macro_rules! m {
4-
($e:expr_2021) => { //~ ERROR: expr_2021 is experimental
4+
($e:expr_2021) => { //~ ERROR: fragment specifier `expr_2021` is unstable
55
$e
66
};
77
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
error: expr_2021 is experimental
1+
error[E0658]: fragment specifier `expr_2021` is unstable
22
--> $DIR/feature-gate-expr_fragment_specifier_2024.rs:4:6
33
|
44
LL | ($e:expr_2021) => {
55
| ^^^^^^^^^^^^
6+
|
7+
= note: see issue #123742 <https://github.com/rust-lang/rust/issues/123742> for more information
8+
= help: add `#![feature(expr_fragment_specifier_2024)]` to the crate attributes to enable
9+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
610

711
error: aborting due to 1 previous error
812

13+
For more information about this error, try `rustc --explain E0658`.

0 commit comments

Comments
 (0)