Rollup merge of #113999 - Centri3:macro-arm-expand, r=wesleywiser
Specify macro is invalid in certain contexts Adds a note when a macro is used where it really shouldn't be. Closes #113766
This commit is contained in:
commit
1f076fe1d8
9 changed files with 246 additions and 24 deletions
|
@ -142,7 +142,11 @@ impl<'a> Parser<'a> {
|
|||
// Parse the first pattern (`p_0`).
|
||||
let mut first_pat = self.parse_pat_no_top_alt(expected, syntax_loc)?;
|
||||
if rc == RecoverComma::Yes {
|
||||
self.maybe_recover_unexpected_comma(first_pat.span, rt)?;
|
||||
self.maybe_recover_unexpected_comma(
|
||||
first_pat.span,
|
||||
matches!(first_pat.kind, PatKind::MacCall(_)),
|
||||
rt,
|
||||
)?;
|
||||
}
|
||||
|
||||
// If the next token is not a `|`,
|
||||
|
@ -184,7 +188,7 @@ impl<'a> Parser<'a> {
|
|||
err
|
||||
})?;
|
||||
if rc == RecoverComma::Yes {
|
||||
self.maybe_recover_unexpected_comma(pat.span, rt)?;
|
||||
self.maybe_recover_unexpected_comma(pat.span, false, rt)?;
|
||||
}
|
||||
pats.push(pat);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue