Standard library, synchronization primitives, and undefined behavior


@Amanieu Are you going to write an RFC? What can we do to help push this forward?


There is a PR for using the parking_lot code inside of libstd now:


If/when this PR is adopted, the Rust cheat sheet will need to be updated for Mutex<T>, since the new parking_lot code does not have a poison field. That would also be a good opportunity to add the missing RwLock<T> to the cheat sheet.


Even with that PR, Mutex will remain backwards-compatible and hence still have poison. It will just use the parking_lot machinery for implementing mutual exclusion, instead of leaving that to OS primitives.


I would absolutely love to update the cheat sheet if a consequence of this work is that the Box is removed. My understanding is that the Box is primarily to ensure that the OS primitive is not moved, and with parking_lot that goes away.