-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Improve the help message for the error on using fully qualified syntax for nested associated types #59225
Comments
I think this error is occured here: rust/src/librustc_typeck/astconv.rs Lines 1393 to 1396 in 15a5dfa
We can replace this |
We have the trait at this point, so we can name it in the error message, rather than using "Trait" as a (potentially confusing) placeholder. Thanks to Yuki "@JohnTitor" Okushi for pointing out where to look (in the same file) for a closely related issue for ambiguous associated types (as opposed to items; that was rust-lang#59225, except that one won't be quite as easy to resolve, because we actually don't have the trait `DefId` at that point).
…_assoc_item, r=petrochenkov name the trait in ambiguous-associated-items fully qualified suggestion We have the trait at this point, so we can name it in the error message, rather than using "Trait" as a (potentially confusing) placeholder. Thanks to Yuki "@JohnTitor" Okushi for pointing out where to look (in the same file) for a closely related issue for ambiguous associated types (as opposed to items; that was rust-lang#59225, except that one won't be quite as easy to resolve, because we actually don't have the trait `DefId` at that point). r? @petrochenkov
I got something similar while playing with diesel. At the same time the error also seemed somewhat incorrect to me? Is this similar here or considered a different issue? error[E0223]: ambiguous associated type
--> src/main.rs:19:45
|
19 | let query = diesel::update(posts.filter(posts::columns::id.eq_any(subquery)))
| ^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<hello::schema::posts::table as Trait>::columns` I was a bit confused what can I do here, it would be good to have some suggestions on what kind of traits could be use for |
On enums3 of the Rustlings exercises you can replicate this error with the following:
Will produce:
It would be great to get a bit more guidance on the reasoning. |
Here is a small example to reproduce the error and its help message:
Then I get the following error:
It looks like the word "
Trait
" in<<Self as B>::Item as Trait>::Item
should be replaced with the trait nameA
so that the suggested expression compiles:help: use fully-qualified syntax:
<<Self as B>::Item as A>::Item
.The text was updated successfully, but these errors were encountered: