-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Unreachable expression in guard-0.3.1, Rust 1.15 #38977
Comments
The root cause is that this code let x = if true {
42
} else {
[panic!()]
}; typechecks on beta and nightly but not stable. In my macro I am trying to make sure the code before cc @eddyb |
That being said, I brought this upon myself with |
@nikomatsakis Is there a good reason for denying/allowing that code? |
Yes, and I relaxed it afterwards by doing the checking in typeck, in a principled fashion. |
@eddyb I am somewhat surprised to learn that this type-checks, although I can imagine how it might come about. |
Well, part of the promise of the
The fact that we can allow it seems like a good reason to allow it. |
Yes, I agree. It's annoying that there's no way to write code that is warning-free on all channels but it doesn't count as a regression. |
|
Oh the rule is that an expected type can't differ unless it's |
To be clear, while I was somewhat surprised, I also think it's ok and makes sense. We've traditionally not considered regressions due to lints triggering as being "real regressions" -- since we cap lints on dependencies they don't affect anyone downstream, to be sure. I think that same policy should apply here, hence no action needed (as long as we're satisfied with how the code is behaving). |
@arielb1 |
Ah, interesting, this is kind of a corner case where the macro is injecting code that generates the lint into its client! Fascinating. |
I've seen a few such reports lately where changes to lints break crates during expansion of other people's macros. |
This is expected behavior. We'll need to update |
Published a new version of guard with passing tests. Users (if there were any) were not affected unless they also had |
https://github.com/durka/guard 8f9753302f549826800820dc4a34ad8d01dccd66
Not on stable.
Many errors like this:
cc @durka
The text was updated successfully, but these errors were encountered: