-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
suggest binding site when issuing "try using a local type parameter instead" err msg #14844
Comments
Same error, different situation: struct A<T> {
inner: T,
}
impl<T> Iterator for A<T> {
type Item = u8;
fn next(&mut self) -> Option<u8> {
fn helper(sel: &Self) -> u8 {
unimplemented!();
}
Some(helper(self))
}
}
fn main() {
} yields
changing the inner function to struct A<T> {
inner: T,
}
impl<T> Iterator for A<T> {
type Item = u8;
fn next(&mut self) -> Option<u8> {
fn helper<U>(sel: &A<U>) -> u8 {
unimplemented!();
}
Some(helper(self))
}
}
fn main() {
} solves the problem |
Yes the number of errors reported is now reasonable, but it still leads to head scratching because it doesn't make it clear that one needs a binding on the |
Current output:
Implementing the suggestion might be slightly harder than just pointing out at the outer type parameter. |
I'll try to tackle that. @estebank Where should I contact you if I have some questions ? |
So I poked around, and the |
@zilbuz sorry for not getting back to you yesterday. As mentioned in passing in #47319 (comment), we probably should modify You can keep updating this ticket, and once you've created a PR move the conversation there. Make sure to include "r? @estebank" in the description so that I review it. |
Won't the |
Evaluate `UnevaluatedConst` in unify fix rust-lang#14844
Evaluate `UnevalutedConst` before trait solving cc rust-lang#14844
UPDATE: Mentoring instructions below.
--
Here is some code:
Here is a transcript of a compilation attempt:
First off, maybe we should be aborting the compilation a little sooner rather than emitting so many seemingly redundant error messages.
Second, I was scratching my head for a little while because I was saying to myself "
T
is a local type parameter". Of course, it is not local enough; one needs to change theimpl Bar for S<T>
toimpl<T> Bar for S<T>
.So, I think it would be good if the error message suggested this; e.g.:
or
The text was updated successfully, but these errors were encountered: