about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJubilee <46493976+workingjubilee@users.noreply.github.com>2021-09-23 17:31:41 -0700
committerGitHub <noreply@github.com>2021-09-23 17:31:41 -0700
commit586d028d0e32773a5ae5602f38e2751d7dd25523 (patch)
treee7cf5380f71254bf9bf08c83a56d50c435f87f35
parent2b862bed9889808b69629fd7246317189b9517a5 (diff)
parent598e5b27beef291c016c13f4dfaf724350f37fce (diff)
downloadrust-586d028d0e32773a5ae5602f38e2751d7dd25523.tar.gz
rust-586d028d0e32773a5ae5602f38e2751d7dd25523.zip
Rollup merge of #88612 - lovasoa:patch-1, r=m-ou-se
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 https://github.com/rust-lang/rust/issues/39364
-rw-r--r--library/std/src/sync/mpsc/shared.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/library/std/src/sync/mpsc/shared.rs b/library/std/src/sync/mpsc/shared.rs
index 0c32e636a56..8487a5f8b50 100644
--- a/library/std/src/sync/mpsc/shared.rs
+++ b/library/std/src/sync/mpsc/shared.rs
@@ -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);