rust-lang / rust-lang/rust-clippy
Spurious warning in #[allow(clippy::non_send_fields_in_send_ty)] for complex thread-safe wrapper
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Summary
Our unsafe implementation of Send for a wrapper type that deliberately strips out all of the !Send components of our complex collection tripped the new clippy lint. This was, in fact the entire point of the type, and why we used an unsafe impl block.
Ping @DJMcNab, the author of that PR.
Lint Name
#[allow(clippy::non_send_fields_in_send_ty)]
Reproducer
See https://github.com/bevyengine/bevy/pull/3519 for the case where this lint triggered spuriously.
The existing warning on World was correct: this impl was in fact unsound, and this PR was an attempt to solve that problem.
Version
rustc 1.60.0-nightly (1bd4fdc94 2022-01-12)
binary: rustc
commit-hash: 1bd4fdc943513e1004f498bbf289279c9784fc6f
commit-date: 2022-01-12
host: x86_64-pc-windows-msvc
release: 1.60.0-nightly
LLVM version: 13.0.0
Additional Labels
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the non_send_fields_in_send_ty warning using the case linked in Bevy PR #3519, then inspect the Clippy lint behavior for the unsafe Send wrapper. Compare it with the existing warning on World; done means the valid wrapper no longer triggers a spurious warning while the unsound World implementation remains diagnosed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100