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

[Place 2.0] Convert Place's projection to a boxed slice #63420

Merged
merged 11 commits into from
Sep 13, 2019

Conversation

spastorino
Copy link
Member

This is still work in progress, it's not compiling right now I need to review a bit more to see what's going on but wanted to open the PR to start discussing it.

r? @oli-obk

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 9, 2019
@rust-highfive

This comment has been minimized.

src/librustc/mir/mod.rs Outdated Show resolved Hide resolved
src/librustc/mir/mod.rs Outdated Show resolved Hide resolved
src/librustc/mir/tcx.rs Outdated Show resolved Hide resolved
src/librustc/mir/visit.rs Outdated Show resolved Hide resolved
src/librustc/mir/visit.rs Show resolved Hide resolved
src/librustc_mir/transform/instcombine.rs Outdated Show resolved Hide resolved
src/librustc_mir/transform/qualify_consts.rs Outdated Show resolved Hide resolved
src/librustc_mir/transform/qualify_consts.rs Outdated Show resolved Hide resolved
src/librustc_mir/transform/uniform_array_move_out.rs Outdated Show resolved Hide resolved
@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

src/librustc_codegen_ssa/mir/analyze.rs Outdated Show resolved Hide resolved
src/librustc/mir/visit.rs Outdated Show resolved Hide resolved
@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@spastorino spastorino marked this pull request as ready for review August 24, 2019 18:08
} else {
&arg_place.projection[..arg_place.projection.len() - 1]
let base_proj = match arg_place.projection {
box [ref base_proj @ .., ProjectionElem::Field(..)] |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move the ref base_proj @ into the patterns above

@oli-obk
Copy link
Contributor

oli-obk commented Sep 13, 2019

one more nit

@oli-obk
Copy link
Contributor

oli-obk commented Sep 13, 2019

@bors r+

@bors
Copy link
Contributor

bors commented Sep 13, 2019

📌 Commit 28db2c9 has been approved by oli-obk

@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 Sep 13, 2019
@bors
Copy link
Contributor

bors commented Sep 13, 2019

⌛ Testing commit 28db2c9 with merge a6946a8...

bors added a commit that referenced this pull request Sep 13, 2019
[Place 2.0] Convert Place's projection to a boxed slice

This is still work in progress, it's not compiling right now I need to review a bit more to see what's going on but wanted to open the PR to start discussing it.

r? @oli-obk
@bors
Copy link
Contributor

bors commented Sep 13, 2019

☀️ Test successful - checks-azure
Approved by: oli-obk
Pushing a6946a8 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 13, 2019
@bors bors merged commit 28db2c9 into rust-lang:master Sep 13, 2019
@rust-highfive
Copy link
Collaborator

📣 Toolstate changed by #63420!

Tested on commit a6946a8.
Direct link to PR: #63420

💔 clippy-driver on windows: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk @phansch @flip1995 @yaahc, @rust-lang/infra).
💔 clippy-driver on linux: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk @phansch @flip1995 @yaahc, @rust-lang/infra).
💔 miri on windows: test-fail → build-fail (cc @oli-obk @RalfJung @eddyb, @rust-lang/infra).
💔 miri on linux: test-fail → build-fail (cc @oli-obk @RalfJung @eddyb, @rust-lang/infra).

rust-highfive added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request Sep 13, 2019
Tested on commit rust-lang/rust@a6946a8.
Direct link to PR: <rust-lang/rust#63420>

💔 clippy-driver on windows: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk @phansch @flip1995 @yaahc, @rust-lang/infra).
💔 clippy-driver on linux: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk @phansch @flip1995 @yaahc, @rust-lang/infra).
💔 miri on windows: test-fail → build-fail (cc @oli-obk @RalfJung @eddyb, @rust-lang/infra).
💔 miri on linux: test-fail → build-fail (cc @oli-obk @RalfJung @eddyb, @rust-lang/infra).
self.eval_static_to_mplace(place_static)?.into()
}
};
let mut op = match &place.base {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When Place 2.0 is done, will we be able to get rid of the mutability here again?
I think there was no mutability when this started, and it would be nice to be able to get back to clean code with immutable variables.

Or maybe this is just a matter of rewriting the final for elem in place.projection.iter() into a fold?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a matter of writing it using fold, gonna send a PR about it as soon as I can resync and compile my rustc copy.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm in order to avoid the mut there I'd need to desugar the ? operator, because it won't work inside fold. Do you think it worth? any better idea?.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking a look!

Does try_fold help?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's what I needed #64473

bors added a commit to rust-lang/rust-clippy that referenced this pull request Sep 14, 2019
Fix rustc breaking change: convert to Place's new boxed slice projection

Addressed breaking changes from rust-lang PR rust-lang/rust#63420

I'm not entirely sure the semantics are preserved as I don't have much knowledge about MIR yet. So this code was largely reverse-engineered from the PR above. I wouldn't be surprised if I did something wrong :).

I followed the instructions to pull latest rustc from master and verified the build break I was seeing in my PR for cast-lossless in Travis CI. With these changes, it compiles again and all tests pass.

Fixes rust-lang/rust#64440

changelog: none
@eddyb eddyb mentioned this pull request Oct 21, 2019
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

7 participants