about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-03-08 11:04:55 +0100
committerGitHub <noreply@github.com>2022-03-08 11:04:55 +0100
commita077e44c14c2199e18eac14381f2fdb5035a6bc3 (patch)
treef28d5d86e4481c1d98e4a95aaba1cfdbb1d6bb4f
parent98d027cfddae4a10cb4408473dbc9f9b1ce4259d (diff)
parent776be7e73e96ffc5d5a760ebe7802b3e06062cd2 (diff)
downloadrust-a077e44c14c2199e18eac14381f2fdb5035a6bc3.tar.gz
rust-a077e44c14c2199e18eac14381f2fdb5035a6bc3.zip
Rollup merge of #94712 - kckeiks:remove-rwlock-read-error-assumption, r=Mark-Simulacrum
promot debug_assert to assert

Fixes #94705
-rw-r--r--library/std/src/sys/unix/rwlock.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/library/std/src/sys/unix/rwlock.rs b/library/std/src/sys/unix/rwlock.rs
index b1faf12c226..1318c5b8e3a 100644
--- a/library/std/src/sys/unix/rwlock.rs
+++ b/library/std/src/sys/unix/rwlock.rs
@@ -48,9 +48,9 @@ impl RWLock {
             }
             panic!("rwlock read lock would result in deadlock");
         } else {
-            // According to POSIX, for a properly initialized rwlock this can only
-            // return EAGAIN or EDEADLK or 0. We rely on that.
-            debug_assert_eq!(r, 0);
+            // POSIX does not make guarantees about all the errors that may be returned.
+            // See issue #94705 for more details.
+            assert_eq!(r, 0, "unexpected error during rwlock read lock: {:?}", r);
             self.num_readers.fetch_add(1, Ordering::Relaxed);
         }
     }