Clippy · Correctness
Arc around a type lacking Send or Sync
clippy::arc_with_non_send_sync
Use Rc for single-threaded sharing, or make the inner value Send and Sync before sharing it across threads.
- Category
- Correctness
- Default level
- warn
- Tier
- P1
- Producer
- Clippy
- Diff scope
- line
Not a defect when
The value never leaves one thread and an API it is handed to demands an Arc, such as a library callback signature or a single-threaded runtime's handle, so Rc is not an option.
What it reads
Clippy, with the compiler behind it. The only pass that compiles.
Tier
Serious: worth interrupting other work for.
The tier bounds how severe a rule may be; its category bounds the tier.Diff scope
The changed line itself.
What--scope contextual looks at to decide whether a change caused the finding.Change it
Turn it off, or make it blocking, without touching the code it flags:
rust-doctor --rule clippy::arc_with_non_send_sync=off .
rust-doctor --rule clippy::arc_with_non_send_sync=error .