about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-01-07 06:54:47 +0000
committerbors <bors@rust-lang.org>2023-01-07 06:54:47 +0000
commit472651aa104dea3e358da78c2548ab035cfaf434 (patch)
tree547c9249a5b4d914b5cc27435bb309b85bd7a27b /compiler/rustc_hir_analysis
parent93bf84c9021350608607330175d0513f71f0f967 (diff)
parent01cb9dcd5b555c3b66f5a133b5cad5fab5245aec (diff)
downloadrust-472651aa104dea3e358da78c2548ab035cfaf434.tar.gz
rust-472651aa104dea3e358da78c2548ab035cfaf434.zip
Auto merge of #106558 - compiler-errors:rollup-lkii3j3, r=compiler-errors
Rollup of 4 pull requests

Successful merges:

 - #106525 (Report WF error for chalk *and* new solver)
 - #106533 (Use smaller spans for missing lifetime/generic args)
 - #106543 (rustdoc: remove no-op CSS `.rustdoc.source .sidebar { width: 0 }`)
 - #106554 (Fix a typo in the explanation of E0588)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_hir_analysis')
-rw-r--r--compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs20
1 files changed, 14 insertions, 6 deletions
diff --git a/compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs b/compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs
index 3df8f776ede..574b1e8b485 100644
--- a/compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs
+++ b/compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs
@@ -597,11 +597,15 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
                 let span = self.path_segment.ident.span;
 
                 // insert a suggestion of the form "Y<'a, 'b>"
-                let ident = self.path_segment.ident.name.to_ident_string();
-                let sugg = format!("{}<{}>", ident, suggested_args);
+                let sugg = format!("<{}>", suggested_args);
                 debug!("sugg: {:?}", sugg);
 
-                err.span_suggestion_verbose(span, &msg, sugg, Applicability::HasPlaceholders);
+                err.span_suggestion_verbose(
+                    span.shrink_to_hi(),
+                    &msg,
+                    sugg,
+                    Applicability::HasPlaceholders,
+                );
             }
 
             AngleBrackets::Available => {
@@ -643,11 +647,15 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
                 let span = self.path_segment.ident.span;
 
                 // insert a suggestion of the form "Y<T, U>"
-                let ident = self.path_segment.ident.name.to_ident_string();
-                let sugg = format!("{}<{}>", ident, suggested_args);
+                let sugg = format!("<{}>", suggested_args);
                 debug!("sugg: {:?}", sugg);
 
-                err.span_suggestion_verbose(span, &msg, sugg, Applicability::HasPlaceholders);
+                err.span_suggestion_verbose(
+                    span.shrink_to_hi(),
+                    &msg,
+                    sugg,
+                    Applicability::HasPlaceholders,
+                );
             }
             AngleBrackets::Available => {
                 let gen_args_span = self.gen_args.span().unwrap();