22.10 The Send and Sync Traits

Rust has two special auto-traits that govern concurrency:

  • Send: Indicates a type can be safely moved to another thread.
  • Sync: Indicates a type can be safely referenced (&T) from multiple threads simultaneously.

Basic types like i32 or u64 automatically implement both because they can be trivially copied between threads. A type such as Rc<T> is neither Send nor Sync because its reference counting isn’t thread-safe. By default, the compiler won’t allow you to share a non-Send or non-Sync type across threads. This design prevents many concurrency mistakes at compile time.