News for hackers. Stuff that matters.
Re:Lock-Free Rust: Crossbeam in 2019 by strictfp on Wednesday January 30, 2019 @03:32PM (#19039131)
Rust enforces exclusive access to a variable before it allows mutation.

But there are plenty of data types like smart pointers, where multiple copies of the original smart pointer points to the same underlying data.

In the eyes of the compiler, these are different variables, and can be manipulated independently.

When writing said smart pointer, however, Rust won't allow you to share data between copies unless you explicitly ask for disabling some of the compile checks. When you do this, you need to manually ensure (thread) safety. And this is where locks and other concurrency primitives generally come in handy.

Re:Lock-Free Rust: Crossbeam in 2019 by crimsonalucard on Wednesday January 30, 2019 @05:33PM (#19040311)
Ah so locks come into play when you deliberately disable compile checks?
Re:Lock-Free Rust: Crossbeam in 2019 by uabstraction on Wednesday January 30, 2019 @07:46PM (#19041205)
Not exactly. Disabling the borrow checker is an internal implementation detail of the locking types, but it happens opaquely to the code using the locks.

The locking types make assurances with regards to the lifetimes of their parameters / contents / return values and these are still enforced by the compiler.