When your type implements two traits with the same fn signatures, there's an ambiguity that can be solved by calling Trait::function(instance_of_type). The error is perfect but could add that as suggestion.
For instance ...
error[E0034]: multiple applicable items in scope
--> librustc/ty/sty.rs:1187:13
|
1187 | vid.index()
| ^^^^^ multiple `index` found
|
note: candidate #1 is defined in an impl of the trait `polonius_engine::Atom` for the type `ty::sty::RegionVid`
--> librustc/ty/sty.rs:1174:5
|
1174 | fn index(self) -> usize {
| ^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in an impl of the trait `rustc_data_structures::indexed_vec::Idx` for the type `ty::sty::RegionVid`
--> librustc/ty/sty.rs:1167:1
|
1167 | / newtype_index!(RegionVid
1168 | | {
1169 | | pub idx
1170 | | DEBUG_FORMAT = custom,
1171 | | });
| |_______^
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: aborting due to previous error
For more information about this error, try `rustc --explain E0034`.
Could say ...
Suggestion: use Idx::index(vid) or Atom::index(vid)
seems like an easy win to me!
funny, I just used this open issue to understand how to solve this error. Please add the above suggestion of calling the trait. It's extremely helpful.
This looks like the same issue as https://github.com/rust-lang/rust/issues/40471.
Most helpful comment
funny, I just used this open issue to understand how to solve this error. Please add the above suggestion of calling the trait. It's extremely helpful.