Skip to content

Commit b894670

Browse files
authored
Rollup merge of rust-lang#40608 - GuillaumeGomez:mutex-doc-inconsistency, r=steveklabnik
Fix mutex's docs inconsistency Fixes rust-lang#40176. r? @steveklabnik cc @rust-lang/docs
2 parents 9a17c82 + e7c2160 commit b894670

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/libstd/sync/mutex.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use sys_common::poison::{self, TryLockError, TryLockResult, LockResult};
3030
///
3131
/// The mutexes in this module implement a strategy called "poisoning" where a
3232
/// mutex is considered poisoned whenever a thread panics while holding the
33-
/// lock. Once a mutex is poisoned, all other threads are unable to access the
33+
/// mutex. Once a mutex is poisoned, all other threads are unable to access the
3434
/// data by default as it is likely tainted (some invariant is not being
3535
/// upheld).
3636
///
@@ -115,7 +115,7 @@ pub struct Mutex<T: ?Sized> {
115115
// Note that this mutex is in a *box*, not inlined into the struct itself.
116116
// Once a native mutex has been used once, its address can never change (it
117117
// can't be moved). This mutex type can be safely moved at any time, so to
118-
// ensure that the native mutex is used correctly we box the inner lock to
118+
// ensure that the native mutex is used correctly we box the inner mutex to
119119
// give it a constant address.
120120
inner: Box<sys::Mutex>,
121121
poison: poison::Flag,
@@ -183,7 +183,7 @@ impl<T: ?Sized> Mutex<T> {
183183
/// Acquires a mutex, blocking the current thread until it is able to do so.
184184
///
185185
/// This function will block the local thread until it is available to acquire
186-
/// the mutex. Upon returning, the thread is the only thread with the mutex
186+
/// the mutex. Upon returning, the thread is the only thread with the lock
187187
/// held. An RAII guard is returned to allow scoped unlock of the lock. When
188188
/// the guard goes out of scope, the mutex will be unlocked.
189189
///
@@ -267,9 +267,9 @@ impl<T: ?Sized> Mutex<T> {
267267
}
268268
}
269269

270-
/// Determines whether the lock is poisoned.
270+
/// Determines whether the mutex is poisoned.
271271
///
272-
/// If another thread is active, the lock can still become poisoned at any
272+
/// If another thread is active, the mutex can still become poisoned at any
273273
/// time. You should not trust a `false` value for program correctness
274274
/// without additional synchronization.
275275
///
@@ -312,7 +312,7 @@ impl<T: ?Sized> Mutex<T> {
312312
#[stable(feature = "mutex_into_inner", since = "1.6.0")]
313313
pub fn into_inner(self) -> LockResult<T> where T: Sized {
314314
// We know statically that there are no outstanding references to
315-
// `self` so there's no need to lock the inner lock.
315+
// `self` so there's no need to lock the inner mutex.
316316
//
317317
// To get the inner value, we'd like to call `data.into_inner()`,
318318
// but because `Mutex` impl-s `Drop`, we can't move out of it, so
@@ -353,7 +353,7 @@ impl<T: ?Sized> Mutex<T> {
353353
#[stable(feature = "mutex_get_mut", since = "1.6.0")]
354354
pub fn get_mut(&mut self) -> LockResult<&mut T> {
355355
// We know statically that there are no other references to `self`, so
356-
// there's no need to lock the inner lock.
356+
// there's no need to lock the inner mutex.
357357
let data = unsafe { &mut *self.data.get() };
358358
poison::map_result(self.poison.borrow(), |_| data )
359359
}

0 commit comments

Comments
 (0)