-
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
Failure to fulfill higher-kinded "outlives" predicate could have better error message #27114
Comments
Message is the same today. Technically this is not hard to do. The hard part is just coming up wit hsomething better. |
I would say something along the lines of " @nikomatsakis or @arielb1 should be able to provide an example there ( |
I'm taking a look at implementing @eddyb's suggestion. Curious about the other examples mentioned, though. |
I've understood the code well enough to see the problem, but not enough to
What seems clear is that while terminating the higher-kinded predicate as One could try to plumb more information up along with the introduced |
@tschottdorf You can add an extra field to Then, a |
@eddyb I think I know how to go about the second part (making a special Let me see if I understand you correctly - you're proposing adding something to Whatever I pass down would have to hold the information that we synthesized a So perhaps a new pub enum ObligationCauseCode<'tcx> {
/// An obligation incurred from treating a higher-ranked trait situated at the specified Span.
HigherRankedRegion(Span) // do we need to keep a nested ObligationCauseCode here?
}
// code_to_error can now check the ObligationCauseCode if it sees a `ReStatic` bound
// and emit a custom error with both the obligation's Span (`&'b i32`) as well as the HRTB (`for<'a> T: 'a {}`). Assuming that that's reasonable (may well not be), one very practical question I have is how to get the |
There was a reason I said it like that, because you can change the callers of |
Ah, gotcha - thanks for the pointers, I'll put something together. |
@tschottdorf You have a couple binaries you should not commit (run |
@tschottdorf Are you still working on this? |
No, knock yourself out! It wasn't worth doing by the time I stopped working on it, though that might've changed in the meantime. |
Hi, is this issue still open. On Rust stable and nightly version 2015/2018 I get following message:
Is this the error the OP was suggesting? |
With the current nightly the message is now:
Is this good enough? I think this was changed through #95565. I tested it again after reading the blog post by Jack Huey. |
I believe the idea is to indicate that the static bound originates from the It looks like 1.78 does a bit better here:
This at least points to the universally-quantified region name, if not the quantification itself. I'm not sure what the bit about "current limitations" is for, though. Perhaps the only relevant limitation for this example is the inability to explain the implication? |
Example:
Error:
It's not necessarily obvious why the type has to be
'static
in this case.The text was updated successfully, but these errors were encountered: