about summary refs log tree commit diff
path: root/src/libstd/sync
diff options
context:
space:
mode:
authorAndrew Paseltiner <apaseltiner@gmail.com>2015-10-16 11:54:05 -0400
committerAndrew Paseltiner <apaseltiner@gmail.com>2015-10-16 18:35:31 -0400
commitd6bd8d8491e89277edbfc9a4e0f8953847abbdd6 (patch)
tree41bc1358ed0b4712768d308ea3e0df04e25eddf5 /src/libstd/sync
parent05cfd72ed1934c92af08dbcb66fd1af6b1298721 (diff)
downloadrust-d6bd8d8491e89277edbfc9a4e0f8953847abbdd6.tar.gz
rust-d6bd8d8491e89277edbfc9a4e0f8953847abbdd6.zip
Add `Shared` pointer and have `{Arc, Rc}` use it
This change has two consequences:

1. It makes `Arc<T>` and `Rc<T>` covariant in `T`.

2. It causes the compiler to reject code that was unsound with respect
to dropck. See compile-fail/issue-29106.rs for an example of code that
no longer compiles. Because of this, this is a [breaking-change].

Fixes #29037.
Fixes #29106.
Diffstat (limited to 'src/libstd/sync')
-rw-r--r--src/libstd/sync/mutex.rs1
-rw-r--r--src/libstd/sync/rwlock.rs1
2 files changed, 2 insertions, 0 deletions
diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs
index aabc06b1986..c0cd6d127d2 100644
--- a/src/libstd/sync/mutex.rs
+++ b/src/libstd/sync/mutex.rs
@@ -293,6 +293,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]
     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 9278481f2d6..750c9e30c5c 100644
--- a/src/libstd/sync/rwlock.rs
+++ b/src/libstd/sync/rwlock.rs
@@ -314,6 +314,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]
     fn drop(&mut self) {
         // IMPORTANT: This code needs to be kept in sync with `RwLock::into_inner`.
         unsafe { self.inner.lock.destroy() }