diff options
| author | Andrew Paseltiner <apaseltiner@gmail.com> | 2016-12-28 17:47:10 -0500 |
|---|---|---|
| committer | Andrew Paseltiner <apaseltiner@gmail.com> | 2016-12-28 17:47:10 -0500 |
| commit | ca9b07bbc974414e2b9055c5e50e38a1973401d2 (patch) | |
| tree | ef605bc894cee8fef58f326ea8a3b097275d1dcb /src | |
| parent | 02b22ec7bd8fa542dd3b08a8497ad5cd3a20c417 (diff) | |
| download | rust-ca9b07bbc974414e2b9055c5e50e38a1973401d2.tar.gz rust-ca9b07bbc974414e2b9055c5e50e38a1973401d2.zip | |
Replace uses of `#[unsafe_destructor_blind_to_params]` with `#[may_dangle]`
CC #34761
Diffstat (limited to 'src')
| -rw-r--r-- | src/liballoc/arc.rs | 3 | ||||
| -rw-r--r-- | src/liballoc/lib.rs | 3 | ||||
| -rw-r--r-- | src/liballoc/raw_vec.rs | 3 | ||||
| -rw-r--r-- | src/liballoc/rc.rs | 3 | ||||
| -rw-r--r-- | src/libarena/lib.rs | 7 | ||||
| -rw-r--r-- | src/libcollections/btree/map.rs | 3 | ||||
| -rw-r--r-- | src/libcollections/lib.rs | 3 | ||||
| -rw-r--r-- | src/libcollections/linked_list.rs | 3 | ||||
| -rw-r--r-- | src/libcollections/vec.rs | 6 | ||||
| -rw-r--r-- | src/libcollections/vec_deque.rs | 3 | ||||
| -rw-r--r-- | src/libstd/collections/hash/table.rs | 3 | ||||
| -rw-r--r-- | src/libstd/lib.rs | 3 | ||||
| -rw-r--r-- | src/libstd/sync/mutex.rs | 3 | ||||
| -rw-r--r-- | src/libstd/sync/rwlock.rs | 3 |
14 files changed, 20 insertions, 29 deletions
diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 1cad8f7f407..393a6a315ca 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -706,7 +706,7 @@ impl<T: ?Sized> Arc<T> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<T: ?Sized> Drop for Arc<T> { +unsafe impl<#[may_dangle] T: ?Sized> Drop for Arc<T> { /// Drops the `Arc`. /// /// This will decrement the strong reference count. If the strong reference @@ -734,7 +734,6 @@ impl<T: ?Sized> Drop for Arc<T> { /// drop(foo); // Doesn't print anything /// drop(foo2); // Prints "dropped!" /// ``` - #[unsafe_destructor_blind_to_params] #[inline] fn drop(&mut self) { // Because `fetch_sub` is already atomic, we do not need to synchronize diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index f9dfdc0e075..3a487ca7b9d 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -79,9 +79,10 @@ #![feature(const_fn)] #![feature(core_intrinsics)] #![feature(custom_attribute)] -#![feature(dropck_parametricity)] +#![feature(dropck_eyepatch)] #![cfg_attr(not(test), feature(exact_size_is_empty))] #![feature(fundamental)] +#![feature(generic_param_attrs)] #![feature(lang_items)] #![feature(needs_allocator)] #![feature(optin_builtin_traits)] diff --git a/src/liballoc/raw_vec.rs b/src/liballoc/raw_vec.rs index f23ea0ea8bf..357a2724e00 100644 --- a/src/liballoc/raw_vec.rs +++ b/src/liballoc/raw_vec.rs @@ -539,8 +539,7 @@ impl<T> RawVec<T> { } } -impl<T> Drop for RawVec<T> { - #[unsafe_destructor_blind_to_params] +unsafe impl<#[may_dangle] T> Drop for RawVec<T> { /// Frees the memory owned by the RawVec *without* trying to Drop its contents. fn drop(&mut self) { let elem_size = mem::size_of::<T>(); diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 86f8c746646..010e378ef2f 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -644,7 +644,7 @@ impl<T: ?Sized> Deref for Rc<T> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<T: ?Sized> Drop for Rc<T> { +unsafe impl<#[may_dangle] T: ?Sized> Drop for Rc<T> { /// Drops the `Rc`. /// /// This will decrement the strong reference count. If the strong reference @@ -672,7 +672,6 @@ impl<T: ?Sized> Drop for Rc<T> { /// drop(foo); // Doesn't print anything /// drop(foo2); // Prints "dropped!" /// ``` - #[unsafe_destructor_blind_to_params] fn drop(&mut self) { unsafe { let ptr = *self.ptr; diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index 6044bec2c5a..bf7333b4936 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -30,10 +30,10 @@ #![feature(alloc)] #![feature(core_intrinsics)] +#![feature(dropck_eyepatch)] #![feature(heap_api)] -#![feature(heap_api)] +#![feature(generic_param_attrs)] #![feature(staged_api)] -#![feature(dropck_parametricity)] #![cfg_attr(test, feature(test))] #![allow(deprecated)] @@ -258,8 +258,7 @@ impl<T> TypedArena<T> { } } -impl<T> Drop for TypedArena<T> { - #[unsafe_destructor_blind_to_params] +unsafe impl<#[may_dangle] T> Drop for TypedArena<T> { fn drop(&mut self) { unsafe { // Determine how much was filled. diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs index 788236c24d0..98c71967f3c 100644 --- a/src/libcollections/btree/map.rs +++ b/src/libcollections/btree/map.rs @@ -137,8 +137,7 @@ pub struct BTreeMap<K, V> { } #[stable(feature = "btree_drop", since = "1.7.0")] -impl<K, V> Drop for BTreeMap<K, V> { - #[unsafe_destructor_blind_to_params] +unsafe impl<#[may_dangle] K, #[may_dangle] V> Drop for BTreeMap<K, V> { fn drop(&mut self) { unsafe { for _ in ptr::read(self).into_iter() { diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index 68b067012d3..9ca56d0aea6 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -35,10 +35,11 @@ #![feature(box_syntax)] #![cfg_attr(not(test), feature(char_escape_debug))] #![feature(core_intrinsics)] -#![feature(dropck_parametricity)] +#![feature(dropck_eyepatch)] #![feature(exact_size_is_empty)] #![feature(fmt_internals)] #![feature(fused)] +#![feature(generic_param_attrs)] #![feature(heap_api)] #![feature(inclusive_range)] #![feature(lang_items)] diff --git a/src/libcollections/linked_list.rs b/src/libcollections/linked_list.rs index 31085509088..7f913d4afe4 100644 --- a/src/libcollections/linked_list.rs +++ b/src/libcollections/linked_list.rs @@ -726,8 +726,7 @@ impl<T> LinkedList<T> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<T> Drop for LinkedList<T> { - #[unsafe_destructor_blind_to_params] +unsafe impl<#[may_dangle] T> Drop for LinkedList<T> { fn drop(&mut self) { while let Some(_) = self.pop_front_node() {} } diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index f2ef54f6e56..48a432943d2 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -1763,8 +1763,7 @@ impl<T: Ord> Ord for Vec<T> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<T> Drop for Vec<T> { - #[unsafe_destructor_blind_to_params] +unsafe impl<#[may_dangle] T> Drop for Vec<T> { fn drop(&mut self) { unsafe { // use drop for [T] @@ -2033,8 +2032,7 @@ impl<T: Clone> Clone for IntoIter<T> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<T> Drop for IntoIter<T> { - #[unsafe_destructor_blind_to_params] +unsafe impl<#[may_dangle] T> Drop for IntoIter<T> { fn drop(&mut self) { // destroy the remaining elements for _x in self.by_ref() {} diff --git a/src/libcollections/vec_deque.rs b/src/libcollections/vec_deque.rs index 67621b860bf..f3a95fa9291 100644 --- a/src/libcollections/vec_deque.rs +++ b/src/libcollections/vec_deque.rs @@ -69,8 +69,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] +unsafe impl<#[may_dangle] T> Drop for VecDeque<T> { fn drop(&mut self) { let (front, back) = self.as_mut_slices(); unsafe { diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs index 2cd9362a657..1ab62130cd3 100644 --- a/src/libstd/collections/hash/table.rs +++ b/src/libstd/collections/hash/table.rs @@ -1061,8 +1061,7 @@ impl<K: Clone, V: Clone> Clone for RawTable<K, V> { } } -impl<K, V> Drop for RawTable<K, V> { - #[unsafe_destructor_blind_to_params] +unsafe impl<#[may_dangle] K, #[may_dangle] V> Drop for RawTable<K, V> { fn drop(&mut self) { if self.capacity == 0 { return; diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index fc5c6968544..3f1975525e4 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -250,13 +250,14 @@ #![feature(const_fn)] #![feature(core_float)] #![feature(core_intrinsics)] -#![feature(dropck_parametricity)] +#![feature(dropck_eyepatch)] #![feature(exact_size_is_empty)] #![feature(float_extras)] #![feature(float_from_str_radix)] #![feature(fn_traits)] #![feature(fnbox)] #![feature(fused)] +#![feature(generic_param_attrs)] #![feature(hashmap_hasher)] #![feature(heap_api)] #![feature(inclusive_range)] diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index f6dbe01d7bd..f8426e3b578 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -280,8 +280,7 @@ impl<T: ?Sized> Mutex<T> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<T: ?Sized> Drop for Mutex<T> { - #[unsafe_destructor_blind_to_params] +unsafe impl<#[may_dangle] T: ?Sized> Drop for Mutex<T> { fn drop(&mut self) { // This is actually safe b/c we know that there is no further usage of // this mutex (it's up to the user to arrange for a mutex to get diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index 0a11c71706b..adbb98e4b1f 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -310,8 +310,7 @@ impl<T: ?Sized> RwLock<T> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<T: ?Sized> Drop for RwLock<T> { - #[unsafe_destructor_blind_to_params] +unsafe impl<#[may_dangle] T: ?Sized> Drop for RwLock<T> { fn drop(&mut self) { // IMPORTANT: This code needs to be kept in sync with `RwLock::into_inner`. unsafe { self.inner.destroy() } |
