Skip to content

Commit 37914ca

Browse files
committed
---
yaml --- r: 195625 b: refs/heads/master c: 25d070f h: refs/heads/master i: 195623: 7fe242d v: v3
1 parent 6a058d4 commit 37914ca

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 35275076f52d53c3dcd9dee85d92a2059a663225
2+
refs/heads/master: 25d070f228a101a806165a434b150a59a54f08ba
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: b3317d68910900f135f9f38e43a7a699bc736b4a
55
refs/heads/try: 961e0358e1a5c0faaef606e31e9965742c1643bf

trunk/src/libstd/sync/mutex.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ pub struct Mutex<T> {
121121
data: UnsafeCell<T>,
122122
}
123123

124+
// these are the only places where `T: Send` matters; all other
125+
// functionality works fine on a single thread.
124126
unsafe impl<T: Send> Send for Mutex<T> { }
125127

126128
unsafe impl<T: Send> Sync for Mutex<T> { }
@@ -179,7 +181,7 @@ pub const MUTEX_INIT: StaticMutex = StaticMutex {
179181
poison: poison::FLAG_INIT,
180182
};
181183

182-
impl<T: Send> Mutex<T> {
184+
impl<T> Mutex<T> {
183185
/// Creates a new mutex in an unlocked state ready for use.
184186
#[stable(feature = "rust1", since = "1.0.0")]
185187
pub fn new(t: T) -> Mutex<T> {
@@ -242,7 +244,7 @@ impl<T: Send> Mutex<T> {
242244

243245
#[unsafe_destructor]
244246
#[stable(feature = "rust1", since = "1.0.0")]
245-
impl<T: Send> Drop for Mutex<T> {
247+
impl<T> Drop for Mutex<T> {
246248
fn drop(&mut self) {
247249
// This is actually safe b/c we know that there is no further usage of
248250
// this mutex (it's up to the user to arrange for a mutex to get
@@ -252,7 +254,7 @@ impl<T: Send> Drop for Mutex<T> {
252254
}
253255

254256
#[stable(feature = "rust1", since = "1.0.0")]
255-
impl<T: fmt::Debug + Send + 'static> fmt::Debug for Mutex<T> {
257+
impl<T: fmt::Debug + 'static> fmt::Debug for Mutex<T> {
256258
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
257259
match self.try_lock() {
258260
Ok(guard) => write!(f, "Mutex {{ data: {:?} }}", *guard),

trunk/src/libstd/sync/rwlock.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ pub struct RwLockWriteGuard<'a, T: 'a> {
129129

130130
impl<'a, T> !marker::Send for RwLockWriteGuard<'a, T> {}
131131

132-
impl<T: Send + Sync> RwLock<T> {
132+
impl<T> RwLock<T> {
133133
/// Creates a new instance of an `RwLock<T>` which is unlocked.
134134
///
135135
/// # Examples
@@ -257,7 +257,7 @@ impl<T> Drop for RwLock<T> {
257257
}
258258

259259
#[stable(feature = "rust1", since = "1.0.0")]
260-
impl<T: fmt::Debug + Send + Sync> fmt::Debug for RwLock<T> {
260+
impl<T: fmt::Debug> fmt::Debug for RwLock<T> {
261261
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
262262
match self.try_read() {
263263
Ok(guard) => write!(f, "RwLock {{ data: {:?} }}", *guard),

0 commit comments

Comments
 (0)