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

create a drop ladder for an array if any value is moved out #46334

Merged
merged 1 commit into from
Dec 3, 2017

Conversation

mikhail-m1
Copy link
Contributor

@mikhail-m1 mikhail-m1 commented Nov 28, 2017

r? @arielb1
first commit for fix #34708 (note: this still handles the subslice case in a very broken manner)

@kennytm kennytm added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 28, 2017
@mikhail-m1
Copy link
Contributor Author

working on subslice support

@@ -632,18 +633,33 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
loop_block
}

fn open_drop_for_array(&mut self, ety: Ty<'tcx>) -> BasicBlock {
debug!("open_drop_for_array({:?})", ety);
fn open_drop_for_array(&mut self, ety: Ty<'tcx>, opt_size: Option<u32>) -> BasicBlock {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think size should be a u64?

@@ -0,0 +1,75 @@
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add this test to src/test/run-pass/dynamic-drop.rs instead? That has a framework that tests leak-proofness in panics.

@arielb1
Copy link
Contributor

arielb1 commented Nov 29, 2017

r=me using the dynamic_drop framework and a u64 for array sizes.

@mikhail-m1 mikhail-m1 force-pushed the slice_pattern_array_drop branch 2 times, most recently from 0ca5f7d to be8f80f Compare November 30, 2017 13:41
@bors
Copy link
Contributor

bors commented Dec 1, 2017

☔ The latest upstream changes (presumably #46425) made this pull request unmergeable. Please resolve the merge conflicts.

@mikhail-m1 mikhail-m1 force-pushed the slice_pattern_array_drop branch from be8f80f to fb7db60 Compare December 2, 2017 19:57
@mikhail-m1 mikhail-m1 force-pushed the slice_pattern_array_drop branch from fb7db60 to 7be2fd8 Compare December 2, 2017 19:57

// if size_of::<ety>() == 0 {
// index_based_loop
// } else {
// ptr_based_loop
// }

let tcx = self.tcx();
if let Some(size) = opt_size {
assert!(size <= (u32::MAX as u64),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

i tried compile

let b : [bool; 5_000_000_000] = [true; 5000000000];
let [x,..] = b;

but compiler fails on earlier stage with OOM

@arielb1
Copy link
Contributor

arielb1 commented Dec 3, 2017

@bors r+

@bors
Copy link
Contributor

bors commented Dec 3, 2017

📌 Commit 7be2fd8 has been approved by arielb1

@arielb1
Copy link
Contributor

arielb1 commented Dec 3, 2017

I suppose we might land this first and then get subslice support working.

@kennytm kennytm 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 3, 2017
@bors
Copy link
Contributor

bors commented Dec 3, 2017

⌛ Testing commit 7be2fd8 with merge 0d11e51...

bors added a commit that referenced this pull request Dec 3, 2017
create a drop ladder for an array if any value is moved out

r? @arielb1
first commit for fix #34708 (note: this still handles the subslice case in a very broken manner)
@bors
Copy link
Contributor

bors commented Dec 3, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: arielb1
Pushing 0d11e51 to master...

@bors bors merged commit 7be2fd8 into rust-lang:master Dec 3, 2017
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MIR] double drop with slice patterns
4 participants