Emit fewer errors on patterns with possible type ascription

This commit is contained in:
Esteban Küber 2023-01-17 01:50:45 +00:00
parent 2d82420665
commit c847a01a3b
5 changed files with 8 additions and 29 deletions

View file

@ -2500,6 +2500,8 @@ impl<'a> Parser<'a> {
Ok(ty) => {
err.span_label(ty.span, "specifying the type of a pattern isn't supported");
self.restore_snapshot(snapshot_type);
let new_span = first_pat.span.to(ty.span);
first_pat = self.mk_pat(new_span, PatKind::Wild);
}
}
err.emit();