about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_hir_typeck/src/method/suggest.rs3
-rw-r--r--tests/run-make/crate-loading/rmake.rs2
2 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_hir_typeck/src/method/suggest.rs b/compiler/rustc_hir_typeck/src/method/suggest.rs
index 31366a30760..ab13b31439c 100644
--- a/compiler/rustc_hir_typeck/src/method/suggest.rs
+++ b/compiler/rustc_hir_typeck/src/method/suggest.rs
@@ -4109,8 +4109,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         let trait_span = self.tcx.def_span(trait_def_id);
         let mut multi_span: MultiSpan = trait_span.into();
         multi_span.push_span_label(trait_span, format!("this is the trait that is needed"));
+        let descr = self.tcx.associated_item(item_def_id).descr();
         multi_span
-            .push_span_label(item_span, format!("the method is available for `{rcvr_ty}` here"));
+            .push_span_label(item_span, format!("the {descr} is available for `{rcvr_ty}` here"));
         for (def_id, import_def_id) in candidates {
             if let Some(import_def_id) = import_def_id {
                 multi_span.push_span_label(
diff --git a/tests/run-make/crate-loading/rmake.rs b/tests/run-make/crate-loading/rmake.rs
index 65cbc8b0b1b..13585edf6cc 100644
--- a/tests/run-make/crate-loading/rmake.rs
+++ b/tests/run-make/crate-loading/rmake.rs
@@ -90,7 +90,7 @@ note: there are multiple different versions of crate `dependency` in the depende
   | ^^^^^^^^^^^^^^^ this is the trait that is needed
 5 |     fn foo(&self);
 6 |     fn bar();
-  |     --------- the method is available for `dep_2_reexport::Type` here
+  |     --------- the associated function is available for `dep_2_reexport::Type` here
   |
  ::: multiple-dep-versions.rs:4:32
   |