Make parse error suggestions verbose and fix spans
Go over all structured parser suggestions and make them verbose style. When suggesting to add or remove delimiters, turn them into multiple suggestion parts.
This commit is contained in:
parent
5e311f933d
commit
692bc344d5
175 changed files with 3197 additions and 786 deletions
|
@ -430,8 +430,10 @@ impl<'a> Parser<'a> {
|
|||
let eq_consumed = match self.token.kind {
|
||||
token::BinOpEq(..) => {
|
||||
// Recover `let x <op>= 1` as `let x = 1`
|
||||
self.dcx()
|
||||
.emit_err(errors::CompoundAssignmentExpressionInLet { span: self.token.span });
|
||||
self.dcx().emit_err(errors::CompoundAssignmentExpressionInLet {
|
||||
span: self.token.span,
|
||||
suggestion: self.token.span.with_hi(self.token.span.lo() + BytePos(1)),
|
||||
});
|
||||
self.bump();
|
||||
true
|
||||
}
|
||||
|
@ -717,7 +719,7 @@ impl<'a> Parser<'a> {
|
|||
e.cancel();
|
||||
self.dcx().emit_err(MalformedLoopLabel {
|
||||
span: label.ident.span,
|
||||
correct_label: label.ident,
|
||||
suggestion: label.ident.span.shrink_to_lo(),
|
||||
});
|
||||
*expr = labeled_expr;
|
||||
break 'break_recover None;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue