Correctly gate the parsing of match arms without body
This commit is contained in:
parent
21cce21d8c
commit
e274372689
9 changed files with 227 additions and 26 deletions
|
@ -2918,7 +2918,12 @@ impl<'a> Parser<'a> {
|
|||
let mut result = if !is_fat_arrow && !is_almost_fat_arrow {
|
||||
// A pattern without a body, allowed for never patterns.
|
||||
arm_body = None;
|
||||
this.expect_one_of(&[token::Comma], &[token::CloseDelim(Delimiter::Brace)])
|
||||
this.expect_one_of(&[token::Comma], &[token::CloseDelim(Delimiter::Brace)]).map(
|
||||
|x| {
|
||||
this.sess.gated_spans.gate(sym::never_patterns, pat.span);
|
||||
x
|
||||
},
|
||||
)
|
||||
} else {
|
||||
if let Err(mut err) = this.expect(&token::FatArrow) {
|
||||
// We might have a `=>` -> `=` or `->` typo (issue #89396).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue