about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/diagnostics.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs
index 9ac3bb946dc..1740f2c2c84 100644
--- a/compiler/rustc_parse/src/parser/diagnostics.rs
+++ b/compiler/rustc_parse/src/parser/diagnostics.rs
@@ -352,12 +352,13 @@ impl<'a> Parser<'a> {
                             // if there is a `<` after the fn name, then don't show a suggestion, show help
 
                             if !self.look_ahead(1, |t| *t == token::Lt) &&
-                                let Ok(snippet) = self.sess.source_map().span_to_snippet(generic.span) &&
-                                let Ok(ident) = self.sess.source_map().span_to_snippet(self.token.span) {
-                                    err.span_suggestion_verbose(
-                                        generic.span.to(self.token.span),
+                                let Ok(snippet) = self.sess.source_map().span_to_snippet(generic.span) {
+                                err.multipart_suggestion_verbose(
                                         format!("place the generic parameter name after the {ident_name} name"),
-                                        format!(" {ident}{snippet}"),
+                                        vec![
+                                            (self.token.span.shrink_to_hi(), snippet),
+                                            (generic.span, String::new())
+                                        ],
                                         Applicability::MaybeIncorrect,
                                     );
                                 } else {