Disallow an arm without a body (except for never patterns)
Parsing now accepts a match arm without a body, so we must make sure to only accept that if the pattern is a never pattern.
This commit is contained in:
parent
0bfebc6105
commit
a2dcb3a6d9
9 changed files with 128 additions and 12 deletions
|
@ -659,8 +659,8 @@ impl Pat {
|
|||
matches!(self.kind, PatKind::Rest)
|
||||
}
|
||||
|
||||
/// Could this be a never pattern? I.e. is it a never pattern modulo macro invocations that
|
||||
/// might return never patterns?
|
||||
/// Whether this could be a never pattern, taking into account that a macro invocation can
|
||||
/// return a never pattern. Used to inform errors during parsing.
|
||||
pub fn could_be_never_pattern(&self) -> bool {
|
||||
let mut could_be_never_pattern = false;
|
||||
self.walk(&mut |pat| match &pat.kind {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue