diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-01-31 07:00:40 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-31 07:00:40 +0100 |
| commit | 2f4602a64cf20a3f22d4a4958910d3698401e8cc (patch) | |
| tree | 03e6a152f80ebc10283667e3a8709c62d37e00e7 /compiler/rustc_parse/src | |
| parent | e58e7b10e13595b4df1b105bfb9ad03c8dee7832 (diff) | |
| parent | c8198a608e42e85a9c93fda795a26ea32af5a370 (diff) | |
| download | rust-2f4602a64cf20a3f22d4a4958910d3698401e8cc.tar.gz rust-2f4602a64cf20a3f22d4a4958910d3698401e8cc.zip | |
Rollup merge of #93395 - camelid:reserved-sugg, r=davidtwco
Improve suggestion for escaping reserved keywords r? `@davidtwco`
Diffstat (limited to 'compiler/rustc_parse/src')
| -rw-r--r-- | compiler/rustc_parse/src/parser/diagnostics.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index 17bac362ec8..7b74b137d21 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -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, ); } |
