|
|
|
|
|
by steveklabnik
136 days ago
|
|
Rust tags every &mut T and every &T with the equivalent of restrict except for when the T transitively contains an UnsafeCell<T>. Types like Arc<T> and Rc<T> are built on top of UnsafeCell<T>. Don’t use shared ownership? You get the semantics you want. It’s the norm for the vast majority of things. |
|
Does Rust/LLVM track aliasing to this degree, or is it all or nothing, like if you have a UnsafeCell anywhere, the whole type is excluded from restrict?