1
Fork 0

Parse a pattern with no arm

This commit is contained in:
Nadrieril 2023-11-27 03:15:56 +01:00
parent caa488b96e
commit 80bdcbf50a
36 changed files with 420 additions and 279 deletions

View file

@ -154,7 +154,7 @@ impl<'a> Parser<'a> {
}
Err(err) => return Err(err),
};
if rc == RecoverComma::Yes {
if rc == RecoverComma::Yes && !first_pat.could_be_never_pattern() {
self.maybe_recover_unexpected_comma(
first_pat.span,
matches!(first_pat.kind, PatKind::MacCall(_)),
@ -200,7 +200,7 @@ impl<'a> Parser<'a> {
err.span_label(lo, WHILE_PARSING_OR_MSG);
err
})?;
if rc == RecoverComma::Yes {
if rc == RecoverComma::Yes && !pat.could_be_never_pattern() {
self.maybe_recover_unexpected_comma(pat.span, false, rt)?;
}
pats.push(pat);