Skip to content

[mir-opt] Fix Inline pass to handle inlining into box expressions - #67333

Merged
bors merged 2 commits into
rust-lang:masterfrom
wesleywiser:fix_inline_into_box_place
Dec 22, 2019
Merged

[mir-opt] Fix Inline pass to handle inlining into box expressions#67333
bors merged 2 commits into
rust-lang:masterfrom
wesleywiser:fix_inline_into_box_place

Conversation

@wesleywiser

@wesleywiserwesleywiser commented Dec 15, 2019

Copy link
Copy Markdown
Member

r? @oli-obk

Before, the test case just ICE'd here:

ref place => bug!("Return place is {:?}, not local", place),

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 15, 2019
@oli-obk

Copy link
Copy Markdown
Contributor

Would x.field = foo(); have hit the same ICE before?

Comment threadsrc/test/mir-opt/inline/inline-into-box-place.rs
@wesleywiser

Copy link
Copy Markdown
MemberAuthor

Would x.field = foo(); have hit the same ICE before?

I tried this

#[inline]fnbar() -> i32{3}fnmain(){letmut foo = (1,2);
foo.1 = bar();}

and it doesn't trigger the issue because we assign the return of bar() to a temporary and then assign that temporary to foo.1 after the call. This ICE occurs specifically when the destination contains a projection.

@oli-obk

Copy link
Copy Markdown
Contributor

This ICE occurs specifically when the destination contains a projection.

So... let x = (42, foo());? Or how is box special in this case?

@wesleywiser

Copy link
Copy Markdown
MemberAuthor

box is special because it causes dest_needs_borrow() to return true. This triggers the reborrow and means that when the Integrator runs, destination has a projection. For let x = (42, foo());, destination is a plain Local.

@oli-obk

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Dec 15, 2019

Copy link
Copy Markdown
Collaborator

📌 Commit b50cee3 has been approved by oli-obk

@bors

bors commented Dec 15, 2019

Copy link
Copy Markdown
Collaborator

🌲 The tree is currently closed for pull requests below priority 1000, this pull request will be tested once the tree is reopened

@borsbors 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 15, 2019
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Dec 19, 2019
bors added a commit that referenced this pull request Dec 19, 2019
Rollup of 9 pull requests
Successful merges:
- #67321 (make htons const fn)
- #67328 (Remove now-redundant range check on u128 -> f32 casts)
- #67333 ([mir-opt] Fix `Inline` pass to handle inlining into `box` expressions)
- #67354 (Fix pointing at arg when cause is outside of call)
- #67363 (Fix handling of wasm import modules and names)
- #67382 (Remove some unnecessary `ATTR_*` constants.)
- #67389 (Remove `SO_NOSIGPIPE` dummy variable on platforms that don't use it.)
- #67393 (Enable opting out of specific default LLVM arguments.)
- #67394 (Remove outdated references to @t from comments)
Failed merges:
r? @ghost
Centril added a commit to Centril/rust that referenced this pull request Dec 20, 2019
@CentrilCentril mentioned this pull request Dec 20, 2019
@Centril

Copy link
Copy Markdown
Contributor

Failed in #67448 (comment), @bors r-

@borsbors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 20, 2019
@wesleywiser
wesleywiserforce-pushed the fix_inline_into_box_place branch from b50cee3 to f1325a7CompareDecember 21, 2019 01:40
@wesleywiser

Copy link
Copy Markdown
MemberAuthor

Rebased and modified new test to skip wasm which aborts instead of unwinding.

@bors r=oli-obk

@bors

bors commented Dec 21, 2019

Copy link
Copy Markdown
Collaborator

📌 Commit f1325a7 has been approved by oli-obk

@bors

bors commented Dec 21, 2019

Copy link
Copy Markdown
Collaborator

🌲 The tree is currently closed for pull requests below priority 100, this pull request will be tested once the tree is reopened

@borsbors 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 21, 2019
Centril added a commit to Centril/rust that referenced this pull request Dec 21, 2019
@CentrilCentril mentioned this pull request Dec 21, 2019
Centril added a commit to Centril/rust that referenced this pull request Dec 21, 2019
@CentrilCentril mentioned this pull request Dec 21, 2019
bors added a commit that referenced this pull request Dec 21, 2019
Rollup of 7 pull requests
Successful merges:
- #67160 (Make GATs less ICE-prone.)
- #67333 ([mir-opt] Fix `Inline` pass to handle inlining into `box` expressions)
- #67420 (use _val to ignore parameter of any::type_name_of_val)
- #67469 (Remove rustc-dev from the default nightly components)
- #67489 (Drop petgraph dependency from bootstrap)
- #67490 (Document privacy of RangeInclusive fields)
- #67491 (use Result::map_or for bootstrap)
Failed merges:
r? @ghost
@bors
bors merged commit f1325a7 into rust-lang:masterDec 22, 2019
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: 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.

5 participants

@wesleywiser@oli-obk@bors@Centril@rust-highfive