summary refs log tree commit diff
path: root/src/libstd/sync
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2017-04-29 09:11:51 +0200
committerRalf Jung <post@ralfj.de>2017-04-29 09:44:09 +0200
commit998a8777379d8f1cd7b263eff50411ba56f1f9e7 (patch)
tree1d569ba333a48b1e3fe8456992a38ebd9ceb9cb1 /src/libstd/sync
parent95467d33cb98c8a9be12da15be559e60628180f5 (diff)
downloadrust-998a8777379d8f1cd7b263eff50411ba56f1f9e7.tar.gz
rust-998a8777379d8f1cd7b263eff50411ba56f1f9e7.zip
MutexGuard<T> may be Sync only if T is Sync
Also remove some unnecessary unsafe impl from the tests.
Diffstat (limited to 'src/libstd/sync')
-rw-r--r--src/libstd/sync/mutex.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs
index a27f621e6b2..bd5a0fd9828 100644
--- a/src/libstd/sync/mutex.rs
+++ b/src/libstd/sync/mutex.rs
@@ -10,7 +10,6 @@
 
 use cell::UnsafeCell;
 use fmt;
-use marker;
 use mem;
 use ops::{Deref, DerefMut};
 use ptr;
@@ -153,7 +152,9 @@ pub struct MutexGuard<'a, T: ?Sized + 'a> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, T: ?Sized> !marker::Send for MutexGuard<'a, T> {}
+impl<'a, T: ?Sized> !Send for MutexGuard<'a, T> { }
+#[stable(feature = "rust1", since = "1.18.0")]
+unsafe impl<'a, T: ?Sized + Sync> Sync for MutexGuard<'a, T> { }
 
 impl<T> Mutex<T> {
     /// Creates a new mutex in an unlocked state ready for use.
@@ -459,9 +460,6 @@ mod tests {
     #[derive(Eq, PartialEq, Debug)]
     struct NonCopy(i32);
 
-    unsafe impl<T: Send> Send for Packet<T> {}
-    unsafe impl<T> Sync for Packet<T> {}
-
     #[test]
     fn smoke() {
         let m = Mutex::new(());