Skip to content

Fix invalid suggestion on &mut iterators yielding & references #70264

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

Merged
merged 1 commit into from
Mar 24, 2020

Conversation

tirr-c
Copy link
Contributor

@tirr-c tirr-c commented Mar 22, 2020

Fixes #69789.

rustc suggested an invalid code when & reference from &mut iterator is mutated. The compiler knew we're mutating a value behind & reference, but as the assignment RHS is from desugaring, it could only see the iterator expression from source and inserted mut there.

r? @estebank

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

@bors r+

@bors
Copy link
Collaborator

bors commented Mar 23, 2020

📌 Commit 1e5d81d has been approved by estebank

@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 Mar 23, 2020
Centril added a commit to Centril/rust that referenced this pull request Mar 23, 2020
…r=estebank

Fix invalid suggestion on `&mut` iterators yielding `&` references

Fixes rust-lang#69789.

rustc suggested an invalid code when `&` reference from `&mut` iterator is mutated. The compiler knew we're mutating a value behind `&` reference, but as the assignment RHS is from desugaring, it could only see the iterator expression from source and inserted `mut` there.

r? @estebank
Centril added a commit to Centril/rust that referenced this pull request Mar 23, 2020
…r=estebank

Fix invalid suggestion on `&mut` iterators yielding `&` references

Fixes rust-lang#69789.

rustc suggested an invalid code when `&` reference from `&mut` iterator is mutated. The compiler knew we're mutating a value behind `&` reference, but as the assignment RHS is from desugaring, it could only see the iterator expression from source and inserted `mut` there.

r? @estebank
This was referenced Mar 23, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 24, 2020
Rollup of 11 pull requests

Successful merges:

 - rust-lang#67761 (Move the dep_graph construction to a dedicated crate.)
 - rust-lang#69740 (Replace some desc logic in librustc_lint with article_and_desc)
 - rust-lang#69981 (Evaluate repeat expression lengths as late as possible)
 - rust-lang#70087 (Remove const eval loop detector)
 - rust-lang#70242 (Improve E0308 error message wording)
 - rust-lang#70264 (Fix invalid suggestion on `&mut` iterators yielding `&` references)
 - rust-lang#70267 (get rid of ConstPropUnsupported; use ZST marker structs instead)
 - rust-lang#70277 (Remove `ReClosureBound`)
 - rust-lang#70283 (Add regression test for rust-lang#70155.)
 - rust-lang#70294 (Account for bad placeholder types in where clauses)
 - rust-lang#70309 (Clean up E0452 explanation)

Failed merges:

r? @ghost
@bors bors merged commit ab2817b into rust-lang:master Mar 24, 2020
@tirr-c tirr-c deleted the issue-69789-mut-suggestion branch March 24, 2020 04:10
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

compiler suggests "&mut mut"
4 participants