Rollup merge of #87646 - JohnTitor:fix-parser-ice, r=oli-obk

Fix a parser ICE on invalid `fn` body

Fixes #87635
A better fix would add a check for `fn` body on `expected_one_of_not_found` but I haven't come up with a graceful way. Any idea?
r? ```@oli-obk``` ```@estebank```
This commit is contained in:
Yuki Okushi 2021-08-03 19:07:44 +09:00 committed by GitHub
commit f69daa2617
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 3 deletions

View file

@ -1714,13 +1714,11 @@ impl<'a> Parser<'a> {
// the AST for typechecking.
err.span_label(ident.span, "while parsing this `fn`");
err.emit();
(Vec::new(), None)
} else {
return Err(err);
}
} else {
unreachable!()
}
(Vec::new(), None)
};
attrs.extend(inner_attrs);
Ok(body)