-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Consider arm to diverge if guard diverges #134735
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
self.check_expr_has_type_or_error(e, tcx.types.bool, |_| {}); | ||
|
||
// FIXME: If this is the first arm and the pattern is irrefutable, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be the place to insert a fix for #134734 (it'll need some extra divergence state tracking variable or something), though it also requires some rudimentary heuristic to compute if a pattern is irrefutable in HIR, since that's currently the responsibility of THIR pattern analysis.
@@ -21,9 +21,13 @@ fn d() { | |||
} | |||
|
|||
fn e() { | |||
// Here the compiler fails to figure out that the `println` is dead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Funny that this wasn't a FIXME, but it's obviously a bug.
@bors r+ rollup |
Rollup of 3 pull requests Successful merges: - rust-lang#134525 (Arbitrary self types v2: unstable doc updates.) - rust-lang#134735 (Consider arm to diverge if guard diverges) - rust-lang#134741 (Actually print all the relevant parts of a coroutine in verbose mode) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#134735 - compiler-errors:arm-diverges, r=WaffleLapkin Consider arm to diverge if guard diverges This is not a fix for rust-lang#134734, but I discovered it when I was gauging how difficult it would be to fix that. It does fix a really old test though :> r? `@WaffleLapkin` or reassign
This is not a fix for #134734, but I discovered it when I was gauging how difficult it would be to fix that. It does fix a really old test though :>
r? @WaffleLapkin or reassign