rust-send-sync

Diagnose and fix Rust Send and Sync trait bound errors at thread and task boundaries.

2|1|Updated Aug 19, 2026
One-click install
npx skills add https://github.com/po4yka/rust-skills --skill rust-send-sync-po4yka
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: rust-send-sync
Source: https://github.com/po4yka/rust-skills/tree/main/skills/rust-send-sync
Command: npx skills add https://github.com/po4yka/rust-skills --skill rust-send-sync-po4yka

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Rust developers hit confusing compiler errors like "cannot be sent between threads safely" or "future cannot be sent between threads safely" when values cross thread or async task boundaries, and the fix is rarely obvious from the error text alone. ## Core Features & Use Cases - Symptom-to-fix routing: A triage table maps exact rustc error messages (E0277, E0321, the codeless async future error) to the section that explains and fixes them. - Auto trait reference tables: Precise Send/Sync rules for references, Box, Arc, Rc, raw pointers, Cell, RefCell, Mutex, RwLock, and lock guards, including why MutexGuard is not Send but is Sync. - Verification tooling: Const assertions, compile_fail doctests, cargo semver-checks, and Clippy lints (arc_with_non_send_sync, await_holding_lock, future_not_send) to lock in auto trait guarantees. - Use Case: You changed a Mutex to an RwLock and the build broke at a distant Arc call site. The skill explains that RwLock<T>: Sync requires T: Send + Sync while Mutex only needs T: Send, and shows how to fix the payload. ## Quick Start Ask the AI to explain why rustc says your type cannot be sent between threads safely and how to fix it.

Frequently Asked Questions about rust-send-sync

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix "cannot be sent between threads safely" in Rust?▼

The error means a Send bound failed; check the help line, which often names Sync on the pointee type. Fix the fields by removing sharing, moving the value, or using Sync interior mutability like atomics or Mutex instead of adding unsafe impls.

What is the difference between Send and Sync in Rust?▼

Send means a value can move to another thread; Sync means it can be shared via references across threads. The key rule is that &T is Send exactly when T is Sync, and both traits are derived field-wise by the compiler.

Why is Arc<Cell<T>> not Send in Rust?▼

Arc<T> requires its payload to be both Send and Sync, because a clone hands shared access to another thread. Cell<T> is Send but never Sync, so wrap the value in a Mutex or use an atomic instead.

Why is MutexGuard not Send but still Sync?▼

POSIX requires the unlocking thread to be the locking thread, so MutexGuard's Drop must run where it was created, making it !Send. It is Sync when T is Sync, so &MutexGuard can be sent to scoped threads for read-only access.

Can I write unsafe impl Send for a reference type?▼

No, rustc rejects it with E0321 because cross-crate traits with default impls like Send can only be implemented for struct or enum types. Implement Sync on the owned type instead, which makes &T Send through the blanket impl.

Why does my async fn future fail with "future cannot be sent between threads safely"?▼

A non-Send value like Rc is held across an .await point, so the generated future is not Send. The note names the value and the trapping await; move the value out of the await scope or write the desugared impl Future + Send signature.