drop_non_drop
should not conditionally trigger depending on target-specific implementations of Mutex
#9332
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
Summary
Starting from rust-lang/rust#95035,
std::sync::Mutex
and other similar synchronization primitives have trivial destructors on some but not all platforms, causing thedrop_non_drop
lint to conditionally trigger ondrop(mutex)
depending on current build targets.Since this makes
#[expect(...)]
hard to use and might lead programmers to incorrectly generalize the behavior from what they see on their local machines, I think Clippy should assume non-trivial destructors for these types regardless of their underlying implementations.Lint Name
drop_non_drop
Reproducer
I tried this code:
I saw this happen:
I expected to see this happen: Identical results for both targets
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: