Improve suggestion for escaping reserved keywords

This commit is contained in:
Noah Lev 2022-01-27 14:53:39 -08:00
parent 21b4a9cfdc
commit c8198a608e
51 changed files with 134 additions and 134 deletions

View file

@ -192,10 +192,10 @@ impl<'a> Parser<'a> {
if ident.is_raw_guess()
&& self.look_ahead(1, |t| valid_follow.contains(&t.kind)) =>
{
err.span_suggestion(
ident.span,
"you can escape reserved keywords to use them as identifiers",
format!("r#{}", ident.name),
err.span_suggestion_verbose(
ident.span.shrink_to_lo(),
&format!("escape `{}` to use it as an identifier", ident.name),
"r#".to_owned(),
Applicability::MaybeIncorrect,
);
}