From c8198a608e42e85a9c93fda795a26ea32af5a370 Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Thu, 27 Jan 2022 14:53:39 -0800 Subject: Improve suggestion for escaping reserved keywords --- compiler/rustc_parse/src/parser/diagnostics.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'compiler/rustc_parse/src/parser') 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, ); } -- cgit 1.4.1-3-g733a5