Rollup merge of #93395 - camelid:reserved-sugg, r=davidtwco

Improve suggestion for escaping reserved keywords

r? `@davidtwco`
This commit is contained in:
Matthias Krüger 2022-01-31 07:00:40 +01:00 committed by GitHub
commit 2f4602a64c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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,
);
}