-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Invalid usage of &mut self in std::sync::mpsc #36934
Copy link
Copy link
Closed
Labels
E-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness
Metadata
Metadata
Assignees
Labels
E-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness
Type
Fields
Give feedbackNo fields configured for issues without a type.
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.