Almost all of the internal code in the mpsc module makes use of &mut self, which isn't valid because it's all explicitly designed to work across multiple threads, meaning the guarantees of &mut self don't hold. This entire implementation dates back to Fall 2013, which is long before the multithreading of &self vs &mut self was even decided!
We should update these implementation details to basically never use &mut self but instead use UnsafeCell where appropriate.
Almost all of the internal code in the
mpscmodule makes use of&mut self, which isn't valid because it's all explicitly designed to work across multiple threads, meaning the guarantees of&mut selfdon't hold. This entire implementation dates back to Fall 2013, which is long before the multithreading of&selfvs&mut selfwas even decided!We should update these implementation details to basically never use
&mut selfbut instead useUnsafeCellwhere appropriate.