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

don't suggest adding let due to bad assignment expressions inside of while loop #93574

Merged
merged 1 commit into from
Feb 2, 2022

Conversation

compiler-errors
Copy link
Member

adds a check that our lhs expression is actually within the conditional part of the while loop, instead of anywhere in the while body.

fixes #93486

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

r? @lcnr

(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 2, 2022
@lcnr
Copy link
Contributor

lcnr commented Feb 2, 2022

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Feb 2, 2022

📌 Commit bc23bbb has been approved by lcnr

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

Rollup of 8 pull requests

Successful merges:

 - rust-lang#92528 (Make `Fingerprint::combine_commutative` associative)
 - rust-lang#93221 ([borrowck] Fix help on mutating &self in async fns)
 - rust-lang#93542 (Prevent lifetime elision in type alias)
 - rust-lang#93546 (Validate that values in switch int terminator are unique)
 - rust-lang#93571 (better suggestion for duplicated `where` clause)
 - rust-lang#93574 (don't suggest adding `let` due to bad assignment expressions inside of `while` loop)
 - rust-lang#93590 (More let_else adoptions)
 - rust-lang#93592 (Remove unused dep from rustc_arena)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 799bded into rust-lang:master Feb 2, 2022
@rustbot rustbot added this to the 1.60.0 milestone Feb 2, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 28, 2022
…delay, r=petrochenkov

Fix ICE when passing block to while-loop condition

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 rust-lang#93574 (i.e. only while loop conditions that have destructuring assignment expressions in them).

Fixes rust-lang#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.
@compiler-errors compiler-errors deleted the bad-let-suggestion branch April 7, 2022 04:34
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.

Invalid Left-hand Assignment Provides Incorrect Syntax as Solution
5 participants