-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
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)
AndrewKvalheim, dignifiedquire, hcpl, russellb23 and iluuu1994
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.