22.11 Send and Sync Traits

Rust has two auto-traits central to concurrency:

  • Send: Indicates that a type can be safely moved to another thread.
  • Sync: Indicates that a type can be safely referenced from multiple threads (shared references).

Simple types like i32 or bool are both Send and Sync. Composite types automatically gain these traits if all their fields implement them. Some types, such as Rc<T>, do not implement Send or Sync because their internal reference counting is not thread-safe. If a type is neither Send nor Sync, Rust prevents you from sharing it across threads, preserving memory safety.