Add explanation for #[must_use] on mutex guards

This commit is contained in:
Manish Goregaokar
2018-05-07 09:27:50 -07:00
parent 6e49c837f6
commit f8b774fbf1
3 changed files with 4 additions and 4 deletions

View File

@@ -41,7 +41,7 @@ unsafe impl<T: Send> Sync for ReentrantMutex<T> {}
/// because implementation of the trait would violate Rusts reference aliasing
/// rules. Use interior mutability (usually `RefCell`) in order to mutate the
/// guarded data.
#[must_use]
#[must_use = "if unused the ReentrantMutex will immediately unlock"]
pub struct ReentrantMutexGuard<'a, T: 'a> {
// funny underscores due to how Deref currently works (it disregards field
// privacy).