Skip to content

Commit db8301b

Browse files
authored
Rollup merge of #106638 - RalfJung:realstd, r=thomcc
std tests: use __OsLocalKeyInner from realstd This is basically the same as #100201, but for __OsLocalKeyInner: Some std tests are failing in Miri on Windows because [this static](https://github.com/rust-lang/rust/blob/a377893da2cd7124e5a18c7116cbb70e16dd5541/library/std/src/sys/windows/thread_local_key.rs#L234-L239) is getting duplicated, and Miri does not handle that properly -- Miri does not support this magic `.CRT$XLB` linker section, but instead just looks up this particular hard-coded static in the standard library. This PR lets the test suite use the std static instead of having its own copy. Fixes rust-lang/miri#2754 r? `@thomcc`
2 parents 890bc3c + ad79b20 commit db8301b

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

library/std/src/thread/mod.rs

+15-7
Original file line numberDiff line numberDiff line change
@@ -177,19 +177,19 @@ use crate::sys_common::thread_parking::Parker;
177177
use crate::sys_common::{AsInner, IntoInner};
178178
use crate::time::Duration;
179179

180+
#[stable(feature = "scoped_threads", since = "1.63.0")]
181+
mod scoped;
182+
183+
#[stable(feature = "scoped_threads", since = "1.63.0")]
184+
pub use scoped::{scope, Scope, ScopedJoinHandle};
185+
180186
////////////////////////////////////////////////////////////////////////////////
181187
// Thread-local storage
182188
////////////////////////////////////////////////////////////////////////////////
183189

184190
#[macro_use]
185191
mod local;
186192

187-
#[stable(feature = "scoped_threads", since = "1.63.0")]
188-
mod scoped;
189-
190-
#[stable(feature = "scoped_threads", since = "1.63.0")]
191-
pub use scoped::{scope, Scope, ScopedJoinHandle};
192-
193193
#[stable(feature = "rust1", since = "1.0.0")]
194194
pub use self::local::{AccessError, LocalKey};
195195

@@ -209,7 +209,6 @@ pub use self::local::{AccessError, LocalKey};
209209
))]
210210
#[doc(hidden)]
211211
pub use self::local::fast::Key as __FastLocalKeyInner;
212-
213212
// when building for tests, use real std's type
214213
#[unstable(feature = "libstd_thread_internals", issue = "none")]
215214
#[cfg(test)]
@@ -220,12 +219,21 @@ pub use self::local::fast::Key as __FastLocalKeyInner;
220219
pub use realstd::thread::__FastLocalKeyInner;
221220

222221
#[unstable(feature = "libstd_thread_internals", issue = "none")]
222+
#[cfg(not(test))]
223223
#[cfg(all(
224224
not(target_thread_local),
225225
not(all(target_family = "wasm", not(target_feature = "atomics"))),
226226
))]
227227
#[doc(hidden)]
228228
pub use self::local::os::Key as __OsLocalKeyInner;
229+
// when building for tests, use real std's type
230+
#[unstable(feature = "libstd_thread_internals", issue = "none")]
231+
#[cfg(test)]
232+
#[cfg(all(
233+
not(target_thread_local),
234+
not(all(target_family = "wasm", not(target_feature = "atomics"))),
235+
))]
236+
pub use realstd::thread::__OsLocalKeyInner;
229237

230238
#[unstable(feature = "libstd_thread_internals", issue = "none")]
231239
#[cfg(all(target_family = "wasm", not(target_feature = "atomics")))]

0 commit comments

Comments
 (0)