-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
await_holding_lock reports explicitly dropped mutex guards as if they weren't dropped #6446
Comments
Thanks for reporting this. This is a duplicate of #6353 as the underlying code is the same, but I will leave this open so other users can find the problem searching for either lint. |
Fixing this would involve fixing/improving drop-tracking in |
Fix `await_holding_lock` not linting `parking_lot` Mutex/RwLock This adds tests for `RwLock` and `parking_lot::{Mutex, RwLock}`, which were added before in 2dc8c08, but never tested in UI tests. I noticed this while reading [fasterthanli.me](https://fasterthanli.me/articles/a-rust-match-made-in-hell) latest blog post, complaining that Clippy doesn't catch this for `parking_lot`. (Too many people read his blog, he's too powerful) Some more things: - Adds a test for #6446 - Improves the lint message changelog: [`await_holding_lock`]: Now also lints for `parking_lot::{Mutex, RwLock}`
Has anything changed in the last year+ concerning drop tracking? @flip1995 |
I don't know. With a quick |
Drop tracking was enabled by default in rust 1.74 ( https://github.com/rust-lang/rust/releases/tag/1.74.0 ) |
I tried this code:
I expected to see this happen: it should pass Clippy with no linting errors because the
MutexGuard
is explicitly dropped before the await point with a call tostd::mem::drop
.Instead, this happened: Clippy failed the lint check because of a violation of
clippy::await_holding_lock
:Running with
--verbose
does not provide any additional information.Additionally, of note, the following code does pass Clippy:
Meta
cargo clippy -V
: clippy 0.0.212 (7eac88a 2020-11-16)rustc -Vv
:Backtrace
The text was updated successfully, but these errors were encountered: