Skip to content
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

Associated type not found error does not attempt to suggest typoed names #55673

Closed
oli-obk opened this issue Nov 4, 2018 · 0 comments · Fixed by #99147
Closed

Associated type not found error does not attempt to suggest typoed names #55673

oli-obk opened this issue Nov 4, 2018 · 0 comments · Fixed by #99147
Labels
A-associated-items Area: Associated items (types, constants & functions) A-diagnostics Area: Messages for errors, warnings, and lints A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` C-enhancement Category: An issue proposing an enhancement or a PR with one. 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

@oli-obk
Copy link
Contributor

oli-obk commented Nov 4, 2018

trait Foo {
    type Bar;
}

fn foo<T: Foo>() where T::Baa: std::fmt::Debug {}

fn main() {
}

(Playground)

Errors:

   Compiling playground v0.0.1 (/playground)
error[E0220]: associated type `Baa` not found for `T`
 --> src/main.rs:5:24
  |
5 | fn foo<T: Foo>() where T::Baa: std::fmt::Debug {}
  |                        ^^^^^^ associated type `Baa` not found

error: aborting due to previous error

For more information about this error, try `rustc --explain E0220`.
error: Could not compile `playground`.

To learn more, run the command again with --verbose.

@oli-obk oli-obk added the A-diagnostics Area: Messages for errors, warnings, and lints label Nov 4, 2018
@estebank estebank added A-associated-items Area: Associated items (types, constants & functions) 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. labels Oct 18, 2019
@crlf0710 crlf0710 added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Jun 11, 2020
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Jul 11, 2022
Mention similarly named associated type even if it's not clearly in supertrait

Due to query cycle avoidance, we sometimes restrict the candidates in `complain_about_assoc_type_not_found` too much so that we can't detect typo replacements from just supertraits.

This creates a more general note of the existence of a similarly named associated type from _all_ visible traits when possible.

Fixes rust-lang#55673
@bors bors closed this as completed in 21d6b1f Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-associated-items Area: Associated items (types, constants & functions) A-diagnostics Area: Messages for errors, warnings, and lints A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` C-enhancement Category: An issue proposing an enhancement or a PR with one. 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants