Taken from #62921 (comment)
#62921 will extend the amount of times we display the disambiguated syntax in cases where multiple traits with the method being called is displayed in the following way:
error[E0034]: multiple applicable items in scope
--> $DIR/method-ambig-two-traits-from-impls2.rs:15:5
|
LL | AB::foo();
| ^^^^^^^ multiple `foo` found
|
note: candidate #1 is defined in an impl of the trait `A` for the type `AB`
--> $DIR/method-ambig-two-traits-from-impls2.rs:7:5
|
LL | fn foo() {}
| ^^^^^^^^
= help: to disambiguate the method call, write `A::foo(...)` instead
note: candidate #2 is defined in an impl of the trait `B` for the type `AB`
--> $DIR/method-ambig-two-traits-from-impls2.rs:11:5
|
LL | fn foo() {}
| ^^^^^^^^
= help: to disambiguate the method call, write `B::foo(...)` instead
It'd be a good idea to take a hard look at this and come up with better output that hopefully is as easy to understand while also incorporating structured suggestions. Sadly, given the current diagnostic machinery, suggestions are shown always at the end, which wouldn't let us show the suggestions interleaved with the notes. The closest we could get is something like the following:
error[E0034]: multiple applicable items in scope
--> $DIR/method-ambig-two-traits-from-impls.rs:15:11
|
LL | AB {}.foo();
| ^^^ multiple `foo` found
|
note: candidate #1 is defined in an impl of the trait `A` for the type `AB`
--> $DIR/method-ambig-two-traits-from-impls2.rs:7:5
|
LL | fn foo() {}
| ^^^^^^^^
note: candidate #2 is defined in an impl of the trait `B` for the type `AB`
--> $DIR/method-ambig-two-traits-from-impls2.rs:11:5
|
LL | fn foo() {}
| ^^^^^^^^
help: disambiguate the method call to a specific trait:
--> $DIR/method-ambig-two-traits-from-impls.rs:15:4
|
LL | A::foo(AB {})
| ^^^^^^^^^^^^^
LL | B::foo(AB {})
| ^^^^^^^^^^^^^
It looks a bit too verbose, but that might be ok.
Taken from #62921 (comment)
#62921 will extend the amount of times we display the disambiguated syntax in cases where multiple traits with the method being called is displayed in the following way:
It'd be a good idea to take a hard look at this and come up with better output that hopefully is as easy to understand while also incorporating structured suggestions. Sadly, given the current diagnostic machinery, suggestions are shown always at the end, which wouldn't let us show the suggestions interleaved with the notes. The closest we could get is something like the following:
It looks a bit too verbose, but that might be ok.