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

Fix ICE when passing block to while-loop condition #94248

Merged
merged 1 commit into from
Feb 28, 2022

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Feb 22, 2022

We were incorrectly delaying a bug when we passed any block (that evaluated to ()) to a while loop. This PR makes the check a bit more sophisticated.

We should only suppress the error here in cases that are equivalent to those we find in #93574 (i.e. only while loop conditions that have destructuring assignment expressions in them).

Fixes #93997
cc @estebank who added this code

I would not be opposed to removing the delay-bug altogether, and just emitting this error always. I much prefer duplicate errors over no errors.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Feb 22, 2022
@rust-highfive
Copy link
Collaborator

r? @petrochenkov

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 22, 2022
@petrochenkov
Copy link
Contributor

This also needs a test.

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 22, 2022
@bors

This comment was marked as resolved.

@compiler-errors
Copy link
Member Author

@rustbot ready

I went ahead and kept the logic I added in this PR, but I am still open to removing the downgrade_to_delayed_bug and emitting two diagnostics if anyone is convinced that is the better solution here.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 26, 2022
@petrochenkov
Copy link
Contributor

r=me after addressing #94248 (comment)

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 26, 2022
@compiler-errors
Copy link
Member Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 28, 2022
@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Feb 28, 2022

📌 Commit 025b7c4 has been approved by petrochenkov

@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 Feb 28, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 28, 2022
…askrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#92399 (fix typo in btree/vec doc: Self -> self)
 - rust-lang#92823 (Tweak diagnostics)
 - rust-lang#94248 (Fix ICE when passing block to while-loop condition)
 - rust-lang#94414 (Fix ICE when using Box<T, A> with large A)
 - rust-lang#94445 (4 - Make more use of `let_chains`)
 - rust-lang#94449 (Add long explanation for E0726)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 9340791 into rust-lang:master Feb 28, 2022
@rustbot rustbot added this to the 1.61.0 milestone Feb 28, 2022
@compiler-errors compiler-errors deleted the fix-while-loop-bad-delay branch April 7, 2022 04:33
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.

failed to get layout for [type error]: the type [type error] has an unknown layout
7 participants