-
Notifications
You must be signed in to change notification settings - Fork 13.3k
method has an incompatible type for trait due to lifetimes has too wide a span #33624
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
Comments
Current output:
|
Current output:
It fails to point at the |
Triage: no change. |
The output from:
is:
The spans indicated are now much shorter but none seem to indicate the 'a that was originally suggested, thus I am not sure if we can agree to close the issue. |
Yeah, the ticket should not be closed as now the shorter span is actively not pointing at where it should be pointing. I'm happy with the output you show above in general compared to what it used to be, but it can be better. |
Has anyone resolved this? I'm very new to rust, so maybe I'm missing an obvious solution, but what's the work around for this? I tried expanding the Before I started learning rust I heard everyone talking about how much the borrow checker is a pain, but so far the only struggle has been these ****ing lifetimes. Any help is greatly appreciated, even if it is only a bandaid for now. |
Things move on, so with:
I get:
Which is similar to the messages from 1.84 but in a different order with the "2,8" block last rather than first.
Now since this sample is designed to reproduce a compiler problem with the least code, this "fixed" code may well be doing something entirely at odds with the intent of the original code that highlighted the compiler problem, so the error messages may still not be optimal. |
…h, r=jackh726 Better error message for late/early lifetime param mismatch Rework the way we report early-/late-bound lifetime param mismatches to equate the trait and impl signatures using region variables, so that we can detect when a late-bound param is present in the signature in place of an early-bound param, or vice versa. The diagnostic is a bit more technical, but it's more obviously clear to see what the problem is, even if it's not great at explaining how to fix it. I think this could be improved further, but I still think it's much better than what exists today. Note to reviewer(s): I'd appreciate if we didn't bikeshed *too* much about this verbiage, b/c I hope it's clear that the old message sucked a lot. I'm happy to file bugs for interested new contributors to improve the messaging further. Edit(fmease): Fixes rust-lang#33624.
Rollup merge of rust-lang#140523 - compiler-errors:late-early-mismatch, r=jackh726 Better error message for late/early lifetime param mismatch Rework the way we report early-/late-bound lifetime param mismatches to equate the trait and impl signatures using region variables, so that we can detect when a late-bound param is present in the signature in place of an early-bound param, or vice versa. The diagnostic is a bit more technical, but it's more obviously clear to see what the problem is, even if it's not great at explaining how to fix it. I think this could be improved further, but I still think it's much better than what exists today. Note to reviewer(s): I'd appreciate if we didn't bikeshed *too* much about this verbiage, b/c I hope it's clear that the old message sucked a lot. I'm happy to file bugs for interested new contributors to improve the messaging further. Edit(fmease): Fixes rust-lang#33624.
Actually not fixed by that PR, my bad. |
For
it would be much more useful if we spanned the offending lifetime rather than the whole method: i.e. like this
instead of
The text was updated successfully, but these errors were encountered: