Skip to content

Commit 7e6cc5f

Browse files
committed
Add diagnostic items to MutexGuard and RwLock Guards
I forgot to add the diagnostic to the actual types in `std` earlier.
1 parent cadd017 commit 7e6cc5f

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

std/src/sync/mutex.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ unsafe impl<T: ?Sized + Send> Sync for Mutex<T> {}
193193
and cause Futures to not implement `Send`"]
194194
#[stable(feature = "rust1", since = "1.0.0")]
195195
#[clippy::has_significant_drop]
196+
#[cfg_attr(not(test), rustc_diagnostic_item = "MutexGuard")]
196197
pub struct MutexGuard<'a, T: ?Sized + 'a> {
197198
lock: &'a Mutex<T>,
198199
poison: poison::Guard,

std/src/sync/rwlock.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ unsafe impl<T: ?Sized + Send + Sync> Sync for RwLock<T> {}
100100
and cause Futures to not implement `Send`"]
101101
#[stable(feature = "rust1", since = "1.0.0")]
102102
#[clippy::has_significant_drop]
103+
#[cfg_attr(not(test), rustc_diagnostic_item = "RwLockReadGuard")]
103104
pub struct RwLockReadGuard<'a, T: ?Sized + 'a> {
104105
lock: &'a RwLock<T>,
105106
}
@@ -124,6 +125,7 @@ unsafe impl<T: ?Sized + Sync> Sync for RwLockReadGuard<'_, T> {}
124125
and cause Future's to not implement `Send`"]
125126
#[stable(feature = "rust1", since = "1.0.0")]
126127
#[clippy::has_significant_drop]
128+
#[cfg_attr(not(test), rustc_diagnostic_item = "RwLockWriteGuard")]
127129
pub struct RwLockWriteGuard<'a, T: ?Sized + 'a> {
128130
lock: &'a RwLock<T>,
129131
poison: poison::Guard,

0 commit comments

Comments
 (0)