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 `=>`.
This commit is contained in:
Nadrieril 2023-11-27 00:50:51 +01:00
parent 80bdcbf50a
commit 0bfebc6105
8 changed files with 27 additions and 29 deletions

View file

@ -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,