]> git.lizzy.rs Git - rust.git/commitdiff
Add diagnostic items to MutexGuard and RwLock Guards
authorAaron Kofsky <aaronko@umich.edu>
Sun, 5 Jun 2022 05:01:54 +0000 (01:01 -0400)
committerAaron Kofsky <aaronko@umich.edu>
Sun, 5 Jun 2022 05:01:54 +0000 (01:01 -0400)
I forgot to add the diagnostic to the actual types in `std` earlier.

library/std/src/sync/mutex.rs
library/std/src/sync/rwlock.rs
src/test/ui/lint/let_underscore/let_underscore_lock.stderr

index 3d8281fe593899e86fe77db24dbe36eaf7667550..d976725c2761adf362278672439fea790aa3de11 100644 (file)
@@ -193,6 +193,7 @@ unsafe impl<T: ?Sized + Send> Sync for Mutex<T> {}
                       and cause Futures to not implement `Send`"]
 #[stable(feature = "rust1", since = "1.0.0")]
 #[clippy::has_significant_drop]
+#[cfg_attr(not(test), rustc_diagnostic_item = "MutexGuard")]
 pub struct MutexGuard<'a, T: ?Sized + 'a> {
     lock: &'a Mutex<T>,
     poison: poison::Guard,
index 4f1b4bedaab25c6758c47e60266c0fffd5fee3d8..e956f00a12fd3835ffe70a9953f5f5cd486ea403 100644 (file)
@@ -100,6 +100,7 @@ unsafe impl<T: ?Sized + Send + Sync> Sync for RwLock<T> {}
                       and cause Futures to not implement `Send`"]
 #[stable(feature = "rust1", since = "1.0.0")]
 #[clippy::has_significant_drop]
+#[cfg_attr(not(test), rustc_diagnostic_item = "RwLockReadGuard")]
 pub struct RwLockReadGuard<'a, T: ?Sized + 'a> {
     lock: &'a RwLock<T>,
 }
@@ -124,6 +125,7 @@ unsafe impl<T: ?Sized + Sync> Sync for RwLockReadGuard<'_, T> {}
                       and cause Future's to not implement `Send`"]
 #[stable(feature = "rust1", since = "1.0.0")]
 #[clippy::has_significant_drop]
+#[cfg_attr(not(test), rustc_diagnostic_item = "RwLockWriteGuard")]
 pub struct RwLockWriteGuard<'a, T: ?Sized + 'a> {
     lock: &'a RwLock<T>,
     poison: poison::Guard,
index b7e14e8c7b5c59b5ac8bf8d2c97024db570dffce..7ff42cb152441bf8aa89e97f66cae963b47e4f6b 100644 (file)
@@ -1,5 +1,5 @@
 error: non-binding let on a synchronization lock
-  --> $DIR/let_underscore_lock.rs:5:5
+  --> $DIR/let_underscore_lock.rs:6:5
    |
 LL |     let _ = data.lock().unwrap();
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^