Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upUnreachable expression in guard-0.3.1, Rust 1.15 #38977
Comments
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
|
That being said, I brought this upon myself with |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis Is there a good reason for denying/allowing that code? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Yes, and I relaxed it afterwards by doing the checking in typeck, in a principled fashion. |
This comment has been minimized.
This comment has been minimized.
|
@eddyb I am somewhat surprised to learn that this type-checks, although I can imagine how it might come about. |
This comment has been minimized.
This comment has been minimized.
|
Well, part of the promise of the
The fact that we can allow it seems like a good reason to allow it. |
This comment has been minimized.
This comment has been minimized.
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. |
durka
referenced this issue
Jan 11, 2017
Closed
Unreachable expression in void-1.0.2, Rust 1.16 #38975
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
Oh the rule is that an expected type can't differ unless it's |
This comment has been minimized.
This comment has been minimized.
|
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). |
This comment has been minimized.
This comment has been minimized.
|
@arielb1 |
This comment has been minimized.
This comment has been minimized.
|
Ah, interesting, this is kind of a corner case where the macro is injecting code that generates the lint into its client! Fascinating. |
This comment has been minimized.
This comment has been minimized.
I've seen a few such reports lately where changes to lints break crates during expansion of other people's macros. |
This comment has been minimized.
This comment has been minimized.
|
This is expected behavior. We'll need to update |
brson
closed this
Jan 12, 2017
This comment has been minimized.
This comment has been minimized.
|
Published a new version of guard with passing tests. Users (if there were any) were not affected unless they also had |
brson commentedJan 11, 2017
https://github.com/durka/guard 8f9753302f549826800820dc4a34ad8d01dccd66
Not on stable.
Many errors like this:
cc @durka