-
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
"no region bound is allowed" errors unless impl mismatches struct defn #6915
Comments
@nikomatsakis I suspect you can enlighten me about some of the details above. |
So, it seems like what is going on is that the region parameterization is lost if it isn't used. Interesting. |
Oops, I was about to comment that this is "working as intended", but then I saw that 'self is phantom on B, and is forgotten about. Definitely a bug. Also, I thought that the showbug2 impl was illegal, but apparently it isn't? I remember somebody on irc having trouble being able to write a |
I don't think this is a backward-compatibility hazard. Nominating well-covered. |
The reason for this is because our treatment of lifetimes (particularly those declared on types) is still half-way between the old, inferred world and the new, declared world. More specifically, we still do the inference, and the type system only considers its results, it doesn't really look at what you declared. (@msullivan this is what I was hoping you could fix with the remaining time :) ) Another case where this crops up is a type like:
which is in fact treated by our system currently as:
because that is what the old inference would have decided. |
Sub-bug of #4846. Just a bug, de-nominating |
Seems to be fixed in latest master (dc48adc) When running the original code example, the
|
When changing the sample to use |
Do not show docs link when lint doesn't start with "clippy::" This small change ensures that if the diagnostic functions are called from outside of Clippy, a docs link is not displayed. --- *Please write a short comment explaining your change (or "none" for internal only changes)* changelog: restrict docs links
In the below, note the following:
showbug1
impl, it errors, even though (I think) the impl syntax is (properly) matching the struct definition forB
showbug2
impl, it does not error, even though the implB<int>
does not matchB<'self, T>
, in my opinion.Transcript:
To be honest, I don't understand why having a region bound is being disallowed in these cases; I can certainly understand a lint warning about having such a error. But in general, I may want to have macros that expand into impls that insert region bounds, and I may sometimes want to plug in struct names into such macros that do not have region pointers.
The text was updated successfully, but these errors were encountered: