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
|
@ -2241,9 +2241,13 @@ impl<'a> Parser<'a> {
|
|||
let kw_token = self.token.clone();
|
||||
let kw_str = pprust::token_to_string(&kw_token);
|
||||
let item = self.parse_item(ForceCollect::No)?;
|
||||
let mut item = item.unwrap().span;
|
||||
if self.token == token::Comma {
|
||||
item = item.to(self.token.span);
|
||||
}
|
||||
self.dcx().emit_err(errors::NestedAdt {
|
||||
span: kw_token.span,
|
||||
item: item.unwrap().span,
|
||||
item,
|
||||
kw_str,
|
||||
keyword: keyword.as_str(),
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue