summary refs log tree commit diff
path: root/compiler/rustc_expand/src/errors.rs
diff options
context:
space:
mode:
authorNadrieril <nadrieril+git@gmail.com>2023-11-27 00:50:51 +0100
committerNadrieril <nadrieril+git@gmail.com>2023-12-03 12:25:46 +0100
commit0bfebc6105ea882d7048057718b2e34d09a5d17e (patch)
treec03bc15ce9507bcb06d0c062738dd62f7514b55a /compiler/rustc_expand/src/errors.rs
parent80bdcbf50a63845dd3cfeb05751ba3dcbd1025b8 (diff)
downloadrust-0bfebc6105ea882d7048057718b2e34d09a5d17e.tar.gz
rust-0bfebc6105ea882d7048057718b2e34d09a5d17e.zip
Detect attempts to expand a macro to a match arm again
Because a macro invocation can expand to a never pattern, we can't rule
out a `arm!(),` arm at parse time. Instead we detect that case at
expansion time, if the macro tries to output a pattern followed by `=>`.
Diffstat (limited to 'compiler/rustc_expand/src/errors.rs')
-rw-r--r--compiler/rustc_expand/src/errors.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_expand/src/errors.rs b/compiler/rustc_expand/src/errors.rs
index d86632c47fc..6e919a8fa9f 100644
--- a/compiler/rustc_expand/src/errors.rs
+++ b/compiler/rustc_expand/src/errors.rs
@@ -304,6 +304,8 @@ pub(crate) struct IncompleteParse<'a> {
     pub label_span: Span,
     pub macro_path: &'a ast::Path,
     pub kind_name: &'a str,
+    #[note(expand_macro_expands_to_match_arm)]
+    pub expands_to_match_arm: Option<()>,
 
     #[suggestion(
         expand_suggestion_add_semi,