Skip to content

Commit 321a598

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 b5b5b54 commit 321a598

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

library/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,

library/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,

src/test/ui/lint/let_underscore/let_underscore_lock.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: non-binding let on a synchronization lock
2-
--> $DIR/let_underscore_lock.rs:5:5
2+
--> $DIR/let_underscore_lock.rs:6:5
33
|
44
LL | let _ = data.lock().unwrap();
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)