Skip to content

Commit

Permalink
Add unsafe_destructor_blind_to_params attribute in spots where it i…
Browse files Browse the repository at this point in the history
…s needed for run-pass tests.

I still cannot do complete run-pass run in `--enable-debug` (*) build
due to rust-lang#27023.

But these bits are certainly necessary.

(*) (even after disabling debuginfo, see rust-lang#27139)
  • Loading branch information
pnkfelix committed Jul 20, 2015
1 parent 2883fe2 commit 28a530f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/libcollections/btree/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,14 @@ impl<T> DoubleEndedIterator for RawItems<T> {
}

impl<T> Drop for RawItems<T> {
#[unsafe_destructor_blind_to_params]
fn drop(&mut self) {
for _ in self.by_ref() {}
}
}

impl<K, V> Drop for Node<K, V> {
#[unsafe_destructor_blind_to_params]
fn drop(&mut self) {
if self.keys.is_null() ||
(unsafe { self.keys.get() as *const K as usize == mem::POST_DROP_USIZE })
Expand Down Expand Up @@ -1394,6 +1396,7 @@ impl<K, V> TraversalImpl for MoveTraversalImpl<K, V> {
}

impl<K, V> Drop for MoveTraversalImpl<K, V> {
#[unsafe_destructor_blind_to_params]
fn drop(&mut self) {
// We need to cleanup the stored values manually, as the RawItems destructor would run
// after our deallocation.
Expand Down
1 change: 1 addition & 0 deletions src/libcollections/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ impl<T: Clone> Clone for VecDeque<T> {

#[stable(feature = "rust1", since = "1.0.0")]
impl<T> Drop for VecDeque<T> {
#[unsafe_destructor_blind_to_params]
fn drop(&mut self) {
self.clear();
unsafe {
Expand Down
7 changes: 6 additions & 1 deletion src/test/run-pass/issue-24805-dropck-itemless.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

#![allow(non_camel_case_types)]

#![feature(unsafe_destructor_blind_to_params)]

trait UserDefined { }

impl UserDefined for i32 { }
Expand All @@ -26,7 +28,10 @@ impl<'a, T> UserDefined for &'a T { }
macro_rules! impl_drop {
($Bound:ident, $Id:ident) => {
struct $Id<T:$Bound>(T);
impl <T:$Bound> Drop for $Id<T> { fn drop(&mut self) { } }
impl <T:$Bound> Drop for $Id<T> {
#[unsafe_destructor_blind_to_params]
fn drop(&mut self) { }
}
}
}

Expand Down

0 comments on commit 28a530f

Please sign in to comment.