Properly differentiate between methods and assoc fns
This commit is contained in:
parent
61058937e5
commit
110b19b2b6
@ -4109,8 +4109,9 @@ fn detect_and_explain_multiple_crate_versions(
|
|||||||
let trait_span = self.tcx.def_span(trait_def_id);
|
let trait_span = self.tcx.def_span(trait_def_id);
|
||||||
let mut multi_span: MultiSpan = trait_span.into();
|
let mut multi_span: MultiSpan = trait_span.into();
|
||||||
multi_span.push_span_label(trait_span, format!("this is the trait that is needed"));
|
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
|
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 {
|
for (def_id, import_def_id) in candidates {
|
||||||
if let Some(import_def_id) = import_def_id {
|
if let Some(import_def_id) = import_def_id {
|
||||||
multi_span.push_span_label(
|
multi_span.push_span_label(
|
||||||
|
@ -90,7 +90,7 @@ fn main() {
|
|||||||
| ^^^^^^^^^^^^^^^ this is the trait that is needed
|
| ^^^^^^^^^^^^^^^ this is the trait that is needed
|
||||||
5 | fn foo(&self);
|
5 | fn foo(&self);
|
||||||
6 | fn bar();
|
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
|
::: multiple-dep-versions.rs:4:32
|
||||||
|
|
|
|
||||||
|
Loading…
Reference in New Issue
Block a user