-
Notifications
You must be signed in to change notification settings - Fork 13.4k
create a drop ladder for an array if any value is moved out #46334
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
Conversation
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 { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
r=me using the |
0ca5f7d
to
be8f80f
Compare
☔ The latest upstream changes (presumably #46425) made this pull request unmergeable. Please resolve the merge conflicts. |
be8f80f
to
fb7db60
Compare
fb7db60
to
7be2fd8
Compare
|
||
// 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), |
There was a problem hiding this comment.
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
@bors r+ |
📌 Commit 7be2fd8 has been approved by |
I suppose we might land this first and then get subslice support working. |
☀️ Test successful - status-appveyor, status-travis |
r? @arielb1
first commit for fix #34708 (note: this still handles the subslice case in a very broken manner)