diff options
| author | Catherine <catherine.3.flores@gmail.com> | 2023-07-24 04:55:47 +0000 |
|---|---|---|
| committer | Catherine Flores <catherine.3.flores@gmail.com> | 2023-07-24 00:25:17 -0500 |
| commit | 287db04636ffefa3fdaa39fe0fdcc3cf75b60444 (patch) | |
| tree | 745b89b10863c02ffe96a33220b12aea6fcfcca2 /compiler/rustc_parse/src/parser/pat.rs | |
| parent | 8771282d4e7a5c4569e49d1f878fb3ba90a974d0 (diff) | |
| download | rust-287db04636ffefa3fdaa39fe0fdcc3cf75b60444.tar.gz rust-287db04636ffefa3fdaa39fe0fdcc3cf75b60444.zip | |
Specify macro is invalid in certain contexts
Diffstat (limited to 'compiler/rustc_parse/src/parser/pat.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/pat.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/compiler/rustc_parse/src/parser/pat.rs b/compiler/rustc_parse/src/parser/pat.rs index 14891c45d81..b477453615d 100644 --- a/compiler/rustc_parse/src/parser/pat.rs +++ b/compiler/rustc_parse/src/parser/pat.rs @@ -135,7 +135,11 @@ impl<'a> Parser<'a> { // Parse the first pattern (`p_0`). let mut first_pat = self.parse_pat_no_top_alt(expected)?; 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 `|`, @@ -177,7 +181,11 @@ impl<'a> Parser<'a> { err })?; if rc == RecoverComma::Yes { - self.maybe_recover_unexpected_comma(pat.span, rt)?; + self.maybe_recover_unexpected_comma( + pat.span, + matches!(pat.kind, PatKind::MacCall(_)), + rt, + )?; } pats.push(pat); } |
