about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src/errors.rs
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-07-03 21:02:27 +0000
committerEsteban Küber <esteban@kuber.com.ar>2024-07-04 02:41:13 +0000
commitf63d2bc657f2158bc37c747bb0835a9d02b864d1 (patch)
tree77896b21cbc8757c6b4b71130e0494da14b6f57f /compiler/rustc_hir_analysis/src/errors.rs
parent89ecae5d852a7346ee4e8240ae7a1130f1f6f458 (diff)
downloadrust-f63d2bc657f2158bc37c747bb0835a9d02b864d1.tar.gz
rust-f63d2bc657f2158bc37c747bb0835a9d02b864d1.zip
Better suggestion span for missing type parameter
Diffstat (limited to 'compiler/rustc_hir_analysis/src/errors.rs')
-rw-r--r--compiler/rustc_hir_analysis/src/errors.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs
index 3ffb51fa992..c2d86efd517 100644
--- a/compiler/rustc_hir_analysis/src/errors.rs
+++ b/compiler/rustc_hir_analysis/src/errors.rs
@@ -453,12 +453,11 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for MissingTypeParams {
             } else {
                 // The user wrote `Iterator`, so we don't have a type we can suggest, but at
                 // least we can clue them to the correct syntax `Iterator<Type>`.
-                err.span_suggestion(
-                    self.span,
+                err.span_suggestion_verbose(
+                    self.span.shrink_to_hi(),
                     fluent::hir_analysis_suggestion,
                     format!(
-                        "{}<{}>",
-                        snippet,
+                        "<{}>",
                         self.missing_type_params
                             .iter()
                             .map(|n| n.to_string())