Skip to content

Commit

Permalink
Rollup merge of #88612 - lovasoa:patch-1, r=m-ou-se
Browse files Browse the repository at this point in the history
Add a better error message for #39364

There is a known bug in the implementation of mpsc channels in rust.
This adds a clearer error message when the bug occurs, so that developers don't lose too much time looking for the origin of the bug.
See #39364
  • Loading branch information
workingjubilee committed Sep 24, 2021
2 parents 2b862be + 598e5b2 commit 586d028
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion library/std/src/sync/mpsc/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,11 @@ impl<T> Packet<T> {
// Returns true if blocking should proceed.
fn decrement(&self, token: SignalToken) -> StartResult {
unsafe {
assert_eq!(self.to_wake.load(Ordering::SeqCst), 0);
assert_eq!(
self.to_wake.load(Ordering::SeqCst),
0,
"This is a known bug in the Rust standard library. See https://github.com/rust-lang/rust/issues/39364"
);
let ptr = token.cast_to_usize();
self.to_wake.store(ptr, Ordering::SeqCst);

Expand Down

0 comments on commit 586d028

Please sign in to comment.