about summary refs log tree commit diff
path: root/compiler/rustc_expand/src/errors.rs
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-07-01 04:25:36 +0200
committerGitHub <noreply@github.com>2025-07-01 04:25:36 +0200
commitcfe1942a3f1a98ea733b544559bd4845e41d5797 (patch)
treed5503c6f0ad2ff03ab758d510e5f2f4981e0ab18 /compiler/rustc_expand/src/errors.rs
parente2ea213874477e0874af598eecdb730ef2a52b32 (diff)
parenta1a066999b9fbfc10e93931d9a552bf87dc32e4d (diff)
downloadrust-cfe1942a3f1a98ea733b544559bd4845e41d5797.tar.gz
rust-cfe1942a3f1a98ea733b544559bd4845e41d5797.zip
Rollup merge of #143245 - tgross35:metavariable-expr-organization, r=petrochenkov
mbe: Add tests and restructure metavariable expressions

Add tests that show better diagnostics, and factor `concat` handling to a separate function. Each commit message has further details.

This performs the nonfunctional perparation for further changes such as https://github.com/rust-lang/rust/pull/142950 and https://github.com/rust-lang/rust/pull/142975 .
Diffstat (limited to 'compiler/rustc_expand/src/errors.rs')
-rw-r--r--compiler/rustc_expand/src/errors.rs21
1 files changed, 13 insertions, 8 deletions
diff --git a/compiler/rustc_expand/src/errors.rs b/compiler/rustc_expand/src/errors.rs
index fe4d2af97a0..fdbc65aff68 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]
@@ -499,3 +491,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,
+    }
+}