Skip to content

Commit 0417b75

Browse files
committed
Auto merge of #94206 - PrestonFrom:significant_drop, r=flip1995
Create clippy lint against unexpectedly late drop for temporaries in match scrutinee expressions A new clippy lint for issue 93883 (rust-lang/rust#93883). Relies on a new trait in `marker` (called `SignificantDrop` to enable linting), which is why this PR is for the rust-lang repo and not the clippy repo. changelog: new lint [`significant_drop_in_scrutinee`]
2 parents cbd05d9 + 9aa3ef2 commit 0417b75

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
@@ -192,6 +192,7 @@ unsafe impl<T: ?Sized + Send> Sync for Mutex<T> {}
192192
points can cause deadlocks, delays, \
193193
and cause Futures to not implement `Send`"]
194194
#[stable(feature = "rust1", since = "1.0.0")]
195+
#[clippy::has_significant_drop]
195196
pub struct MutexGuard<'a, T: ?Sized + 'a> {
196197
lock: &'a Mutex<T>,
197198
poison: poison::Guard,

std/src/sync/rwlock.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ unsafe impl<T: ?Sized + Send + Sync> Sync for RwLock<T> {}
9999
points can cause deadlocks, delays, \
100100
and cause Futures to not implement `Send`"]
101101
#[stable(feature = "rust1", since = "1.0.0")]
102+
#[clippy::has_significant_drop]
102103
pub struct RwLockReadGuard<'a, T: ?Sized + 'a> {
103104
lock: &'a RwLock<T>,
104105
}
@@ -122,6 +123,7 @@ unsafe impl<T: ?Sized + Sync> Sync for RwLockReadGuard<'_, T> {}
122123
points can cause deadlocks, delays, \
123124
and cause Future's to not implement `Send`"]
124125
#[stable(feature = "rust1", since = "1.0.0")]
126+
#[clippy::has_significant_drop]
125127
pub struct RwLockWriteGuard<'a, T: ?Sized + 'a> {
126128
lock: &'a RwLock<T>,
127129
poison: poison::Guard,

0 commit comments

Comments
 (0)