Skip to content

Commit

Permalink
Unrolled build for rust-lang#128135
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#128135 - joboet:reduplicate_tls, r=tgross35

std: use duplicate thread local state in tests

With rust-lang/miri#3739 merged, the deduplication hack is no longer necessary.
  • Loading branch information
rust-timer committed Jul 25, 2024
2 parents c1a6199 + a4dd0d6 commit 850fa51
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions library/std/src/thread/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,22 +192,14 @@ pub use scoped::{scope, Scope, ScopedJoinHandle};
#[macro_use]
mod local;

cfg_if::cfg_if! {
if #[cfg(test)] {
// Avoid duplicating the global state associated with thread-locals between this crate and
// realstd. Miri relies on this.
pub use realstd::thread::{local_impl, AccessError, LocalKey};
} else {
#[stable(feature = "rust1", since = "1.0.0")]
pub use self::local::{AccessError, LocalKey};

// Implementation details used by the thread_local!{} macro.
#[doc(hidden)]
#[unstable(feature = "thread_local_internals", issue = "none")]
pub mod local_impl {
pub use crate::sys::thread_local::*;
}
}
#[stable(feature = "rust1", since = "1.0.0")]
pub use self::local::{AccessError, LocalKey};

// Implementation details used by the thread_local!{} macro.
#[doc(hidden)]
#[unstable(feature = "thread_local_internals", issue = "none")]
pub mod local_impl {
pub use crate::sys::thread_local::*;
}

////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 850fa51

Please sign in to comment.