Skip to content
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

Consider arm to diverge if guard diverges #134735

Merged
merged 1 commit into from
Dec 25, 2024

Conversation

compiler-errors
Copy link
Member

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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 24, 2024
self.check_expr_has_type_or_error(e, tcx.types.bool, |_| {});

// FIXME: If this is the first arm and the pattern is irrefutable,
Copy link
Member Author

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.
Copy link
Member Author

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.

@WaffleLapkin
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Dec 25, 2024

📌 Commit a6a7071 has been approved by WaffleLapkin

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 25, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 25, 2024
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
@bors bors merged commit a247d7b into rust-lang:master Dec 25, 2024
6 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Dec 25, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 25, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants