mbe: Shorten `MetaVarExpr` -> `Mve` in structural diagnostics
More diagnostic structs related to metavariable expressions will be
introduced. Introduce the abbreviation "mve" which is reasonably
unambiguous (`rg Mve` and `rg '(\b|_|-)mve(\b|_|-)'` return no results
outside of a Thumb target feature) and use it for these diagnostic
types. A new module is also created.
diff --git a/compiler/rustc_expand/messages.ftl b/compiler/rustc_expand/messages.ftl
index 8b7c47d..85ded85 100644
--- a/compiler/rustc_expand/messages.ftl
+++ b/compiler/rustc_expand/messages.ftl
@@ -109,9 +109,6 @@
expand_meta_var_dif_seq_matchers = {$msg}
-expand_meta_var_expr_unrecognized_var =
- variable `{$key}` is not recognized in meta-variable expression
-
expand_missing_fragment_specifier = missing fragment specifier
.note = fragment specifiers must be provided
.suggestion_add_fragspec = try adding a specifier here
@@ -136,6 +133,9 @@
expand_must_repeat_once =
this must repeat at least once
+expand_mve_unrecognized_var =
+ variable `{$key}` is not recognized in meta-variable expression
+
expand_non_inline_modules_in_proc_macro_input_are_unstable =
non-inline modules in proc macro input are unstable
diff --git a/compiler/rustc_expand/src/errors.rs b/compiler/rustc_expand/src/errors.rs
index 714ba3b..0d77916 100644
--- a/compiler/rustc_expand/src/errors.rs
+++ b/compiler/rustc_expand/src/errors.rs
@@ -28,14 +28,6 @@ pub(crate) struct CountRepetitionMisplaced {
}
#[derive(Diagnostic)]
-#[diag(expand_meta_var_expr_unrecognized_var)]
-pub(crate) struct MetaVarExprUnrecognizedVar {
- #[primary_span]
- pub span: Span,
- pub key: MacroRulesNormalizedIdent,
-}
-
-#[derive(Diagnostic)]
#[diag(expand_var_still_repeating)]
pub(crate) struct VarStillRepeating {
#[primary_span]
@@ -500,3 +492,16 @@ pub(crate) struct ProcMacroBackCompat {
pub crate_name: String,
pub fixed_version: String,
}
+
+pub(crate) use metavar_exprs::*;
+mod metavar_exprs {
+ use super::*;
+
+ #[derive(Diagnostic)]
+ #[diag(expand_mve_unrecognized_var)]
+ pub(crate) struct MveUnrecognizedVar {
+ #[primary_span]
+ pub span: Span,
+ pub key: MacroRulesNormalizedIdent,
+ }
+}
diff --git a/compiler/rustc_expand/src/mbe/transcribe.rs b/compiler/rustc_expand/src/mbe/transcribe.rs
index 0520be5..1781a0c 100644
--- a/compiler/rustc_expand/src/mbe/transcribe.rs
+++ b/compiler/rustc_expand/src/mbe/transcribe.rs
@@ -17,7 +17,7 @@
use smallvec::{SmallVec, smallvec};
use crate::errors::{
- CountRepetitionMisplaced, MetaVarExprUnrecognizedVar, MetaVarsDifSeqMatchers, MustRepeatOnce,
+ CountRepetitionMisplaced, MetaVarsDifSeqMatchers, MustRepeatOnce, MveUnrecognizedVar,
NoSyntaxVarsExprRepeat, VarStillRepeating,
};
use crate::mbe::macro_parser::NamedMatch;
@@ -879,7 +879,7 @@ fn matched_from_ident<'ctx, 'interp, 'rslt>(
{
let span = ident.span;
let key = MacroRulesNormalizedIdent::new(ident);
- interp.get(&key).ok_or_else(|| dcx.create_err(MetaVarExprUnrecognizedVar { span, key }))
+ interp.get(&key).ok_or_else(|| dcx.create_err(MveUnrecognizedVar { span, key }))
}
/// Used by meta-variable expressions when an user input is out of the actual declared bounds. For