diff options
| author | Noah Lev <camelidcamel@gmail.com> | 2022-01-27 14:53:39 -0800 |
|---|---|---|
| committer | Noah Lev <camelidcamel@gmail.com> | 2022-01-27 14:53:39 -0800 |
| commit | c8198a608e42e85a9c93fda795a26ea32af5a370 (patch) | |
| tree | b493bf2bdbffc8f994cbd6efa25d4b8ce19a835c /compiler/rustc_parse/src/parser/diagnostics.rs | |
| parent | 21b4a9cfdcbb1e76f4b36b5c3cfd64d627285093 (diff) | |
| download | rust-c8198a608e42e85a9c93fda795a26ea32af5a370.tar.gz rust-c8198a608e42e85a9c93fda795a26ea32af5a370.zip | |
Improve suggestion for escaping reserved keywords
Diffstat (limited to 'compiler/rustc_parse/src/parser/diagnostics.rs')
| -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, ); } |
