about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-10-22 06:42:10 +0000
committerbors <bors@rust-lang.org>2023-10-22 06:42:10 +0000
commitf6be93fc61fb487c496c94ebe76ee999572fc927 (patch)
tree21b99801ee214bdc2a57505bdd1dfd64b1b908dc /compiler/rustc_hir_analysis/src
parent49e8acbfe953f0c5209916830e02dcc7e005cf68 (diff)
parent8cbac823d016c1afb3c24e3d87c2896566a7d5d7 (diff)
downloadrust-f6be93fc61fb487c496c94ebe76ee999572fc927.tar.gz
rust-f6be93fc61fb487c496c94ebe76ee999572fc927.zip
Auto merge of #3133 - rust-lang:rustup-2023-10-22, r=RalfJung
Automatic Rustup
Diffstat (limited to 'compiler/rustc_hir_analysis/src')
-rw-r--r--compiler/rustc_hir_analysis/src/check/compare_impl_item.rs24
1 files changed, 5 insertions, 19 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
index a1470cc69c3..74e2b157dd0 100644
--- a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
+++ b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
@@ -1557,38 +1557,24 @@ fn compare_number_of_generics<'tcx>(
                 DiagnosticId::Error("E0049".into()),
             );
 
-            let mut suffix = None;
-
+            let msg =
+                format!("expected {trait_count} {kind} parameter{}", pluralize!(trait_count),);
             if let Some(spans) = trait_spans {
                 let mut spans = spans.iter();
                 if let Some(span) = spans.next() {
-                    err.span_label(
-                        *span,
-                        format!(
-                            "expected {} {} parameter{}",
-                            trait_count,
-                            kind,
-                            pluralize!(trait_count),
-                        ),
-                    );
+                    err.span_label(*span, msg);
                 }
                 for span in spans {
                     err.span_label(*span, "");
                 }
             } else {
-                suffix = Some(format!(", expected {trait_count}"));
+                err.span_label(tcx.def_span(trait_.def_id), msg);
             }
 
             if let Some(span) = span {
                 err.span_label(
                     span,
-                    format!(
-                        "found {} {} parameter{}{}",
-                        impl_count,
-                        kind,
-                        pluralize!(impl_count),
-                        suffix.unwrap_or_default(),
-                    ),
+                    format!("found {} {} parameter{}", impl_count, kind, pluralize!(impl_count),),
                 );
             }