[Pkg-rust-maintainers] Bug#1152056: rustc: Fix test_rwlock_max_readers hanging on non-linux 32b archs
Samuel Thibault
sthibault at debian.org
Sun Oct 25 20:01:35 GMT 2026
Package: rustc
Version: 1.97.1+dfsg1-1
Severity: important
Tags: patch upstream
Forwarded: https://github.com/rust-lang/rust/pull/164764
Hello,
test_rwlock_max_readers currently hangs on non-linux 32b archs, making
the build get stuck on hurd-i386, the attached patch was applied
upstream to fix this, could you apply it?
Thanks,
Samuel
-- System Information:
Debian Release: forky/sid
APT prefers testing
APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 'testing-debug'), (500, 'stable-security'), (500, 'stable-debug'), (500, 'proposed-updates'), (500, 'oldstable-debug'), (500, 'oldoldstable'), (500, 'buildd-unstable'), (500, 'unstable'), (500, 'stable'), (500, 'oldstable'), (1, 'experimental-debug'), (1, 'buildd-experimental'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, arm64
Kernel: Linux 7.2.9+deb14-amd64 (SMP w/22 CPU threads; PREEMPT)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages rustc depends on:
ii binutils 2.47-6
ii gcc 4:16.1.0-3
ii libc6 2.43-7
ii libc6-dev [libc-dev] 2.43-7
ii libgcc-s1 16.2.0-3
ii libstd-rust-dev 1.97.1+dfsg1-1
Versions of packages rustc recommends:
ii cargo 1.97.1+dfsg1-1
ii rust-llvm 1.97.1+dfsg1-1
rustc suggests no packages.
-- no debconf information
--
Samuel
"I don't know why, but first C programs tend to look a lot worse than
first programs in any other language (maybe except for fortran, but then
I suspect all fortran programs look like `firsts')"
(By Olaf Kirch)
-------------- next part --------------
commit dfa3e66f7344e39da3bd6c9c58acb14ebd286db1
Author: Samuel Thibault <samuel.thibault at ens-lyon.org>
Date: Sun Oct 25 04:50:40 2026 +0000
Test(lib/sync): Fix `test_rwlock_max_readers` for 32bit architectures
* Test(lib/sync): Fix `test_rwlock_max_readers` for 32bit architectures
962e9e2aab0d ("Fix `test_rwlock_max_readers` for x86 Win7") detected the
issue but fixed it only for windows.
As mentioned in the comment above the test, with the queue implementation,
the counter for the number of threads has 4 bits reserved for management. On
64bit platforms, there are still ample room for u32::MAX readers, but on 32b
platforms, only 2^28-1 readers can fit. We can still test u32::MAX readers
on 64b platforms, thus keeping the min with usize::MAX >> 4.
Fixes 83a7a4ad74ad ("Clarified docs in std::sync::RwLock and added a test
that checks if we can reach max reader")
Signed-off-by: Samuel Thibault <samuel.thibault at ens-lyon.org>
Index: rustc-1.97.1+dfsg1/library/std/tests/sync/rwlock.rs
===================================================================
--- rustc-1.97.1+dfsg1.orig/library/std/tests/sync/rwlock.rs
+++ rustc-1.97.1+dfsg1/library/std/tests/sync/rwlock.rs
@@ -923,16 +923,16 @@ fn test_rwlock_max_readers() {
},
any(
target_family = "unix",
- all(target_os = "windows", target_vendor = "win7", target_pointer_width = "64"),
+ all(target_os = "windows", target_vendor = "win7"),
all(target_vendor = "fortanix", target_env = "sgx"),
target_os = "xous",
target_os = "teeos",
) => {
- u32::MAX
- },
- // Otherwise a form of deadlock is observed.
- all(target_os = "windows", target_vendor = "win7", target_pointer_width = "32") => {
- (1 << 28) - 1
+ if usize::BITS - 4 > u32::BITS {
+ u32::MAX
+ } else {
+ (usize::MAX >> 4) as u32
+ }
},
target_os = "solid_asp3" => {
(1 << 30)
More information about the Pkg-rust-maintainers
mailing list