Emit fewer errors on patterns with possible type ascription
This commit is contained in:
parent
2d82420665
commit
c847a01a3b
5 changed files with 8 additions and 29 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue