Simplify pattern grammar by allowing nested leading vert

Along the way, we also implement a handful of diagnostics improvements
and fixes, particularly with respect to the special handling of `||` in
place of `|` and when there are leading verts in function params, which
don't allow top-level or-patterns anyway.
This commit is contained in:
mark 2021-02-07 20:40:33 -06:00
parent d1206f950f
commit aee1e59e6f
18 changed files with 189 additions and 303 deletions

View file

@ -1654,7 +1654,7 @@ impl<'a> Parser<'a> {
}
pub(super) fn recover_arg_parse(&mut self) -> PResult<'a, (P<ast::Pat>, P<ast::Ty>)> {
let pat = self.parse_pat(Some("argument name"))?;
let pat = self.parse_pat_no_top_alt(Some("argument name"))?;
self.expect(&token::Colon)?;
let ty = self.parse_ty()?;