-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong trait in "use the fully qualified path for the potential candidates" suggestion #96295
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
D-papercut
Diagnostics: An error or lint that needs small tweaks.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
I think the only short term solution we can have here is not to emit the suggestion at all for these cases. A generalized solution to provide the right suggestion might require some more extensive development work than I can tackle at the moment. |
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
May 12, 2022
…ualified-path, r=estebank Stop suggesting non-existing fully qualified paths This patch fixes a part of rust-lang#96295. r? `@estebank`
16 tasks
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
D-papercut
Diagnostics: An error or lint that needs small tweaks.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=ee16c31890addb9bd9e64b3d393a2de3
The current output is:
The two suggestions
<B as I<i32>>::method(a)
and<B as I<u32>>::method(a)
are nonsensical becausea
is not of typeB
and the traitI<T>
does not have a method calledmethod
. This is not how the ambiguous type would need to be disambiguated.Instead a correct suggestion would look like one of the following:
<A<B> as V<i32>>::method(a)
<A<_> as V<i32>>::method(a)
<_ as V<i32>>::method(a)
<V<i32>>::method(a)
V::<i32>::method(a)
Exactly which one of the above 5 correct possibilities is chosen is related to #96292, but this issue focuses on the fact that the current suggestion's trait is wrong (
I
vsV
).The text was updated successfully, but these errors were encountered: