logo
  • Search
  • Reddit Posts 🔥
  • Archive
  • GitHub

Puzzle: Why is Mutex<T> always Sync, but RwLock<T> is only Sync for T: Sync?

74 points obi1kenobi82 2023-02-02 07:10:02
View on Reddit ↗

Fun Rust puzzle of the day: Why is Mutex<T> always Sync (even if T is not Sync), but RwLock<T> is only Sync for T: Sync?
https://doc.rust-lang.org/std/sync/struct.RwLock.html#impl-Sync-for-RwLock%3CT%3E

What bad thing happens if we make RwLock<T> always Sync even if T is not Sync?

© 2025 Query.rs, built by Folyd with ❤️❤️, see about page to learn more · meiguo.app · aiberm.com