2 ms·
Let me ask you then: would you use a Rust library in multithreaded code, without checking if that library is thread-safe? Wouldn't you like your compiler to te
by amelius 8y ago
Let me ask you then: would you use a Rust library in multithreaded code, without checking if that library is thread-safe? Wouldn't you like your compiler to tell you?
- steveklabnik 8y agoAll the time. The compiler does tell you if it’s thread safe. That’s the point.
- GolDDranks 8y agoThere is so called marker traits Send and Sync that are used to track whether something is tread-safe or not. https://doc.rust-lang.org/beta/nomicon/send-and-sync.html https://doc.rust-lang.org/beta/nomicon/send-and-sync.html Regardless of whether you use unsafe or not, thread safety is tracked with these and they allow the compiler to detect and prohibit data races.