diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs index acd6970f113..f5a1093be2b 100644 --- a/src/libstd/thread/local.rs +++ b/src/libstd/thread/local.rs @@ -95,7 +95,7 @@ macro_rules! thread_local { (static $name:ident: $t:ty = $init:expr) => ( static $name: ::std::thread::LocalKey<$t> = { use std::cell::UnsafeCell as __UnsafeCell; - use std::thread::__local::__impl::KeyInner as __KeyInner; + use std::thread::__local::KeyInner as __KeyInner; use std::option::Option as __Option; use std::option::Option::None as __None; @@ -112,7 +112,7 @@ macro_rules! thread_local { (pub static $name:ident: $t:ty = $init:expr) => ( pub static $name: ::std::thread::LocalKey<$t> = { use std::cell::UnsafeCell as __UnsafeCell; - use std::thread::__local::__impl::KeyInner as __KeyInner; + use std::thread::__local::KeyInner as __KeyInner; use std::option::Option as __Option; use std::option::Option::None as __None; @@ -156,20 +156,20 @@ macro_rules! __thread_local_inner { #[cfg_attr(all(any(target_os = "macos", target_os = "linux"), not(target_arch = "aarch64")), thread_local)] - static $name: ::std::thread::__local::__impl::KeyInner<$t> = + static $name: ::std::thread::__local::KeyInner<$t> = __thread_local_inner!($init, $t); ); (pub static $name:ident: $t:ty = $init:expr) => ( #[cfg_attr(all(any(target_os = "macos", target_os = "linux"), not(target_arch = "aarch64")), thread_local)] - pub static $name: ::std::thread::__local::__impl::KeyInner<$t> = + pub static $name: ::std::thread::__local::KeyInner<$t> = __thread_local_inner!($init, $t); ); ($init:expr, $t:ty) => ({ #[cfg(all(any(target_os = "macos", target_os = "linux"), not(target_arch = "aarch64")))] - const _INIT: ::std::thread::__local::__impl::KeyInner<$t> = { - ::std::thread::__local::__impl::KeyInner { + const _INIT: ::std::thread::__local::KeyInner<$t> = { + ::std::thread::__local::KeyInner { inner: ::std::cell::UnsafeCell { value: $init }, dtor_registered: ::std::cell::UnsafeCell { value: false }, dtor_running: ::std::cell::UnsafeCell { value: false }, @@ -178,13 +178,13 @@ macro_rules! __thread_local_inner { #[allow(trivial_casts)] #[cfg(any(not(any(target_os = "macos", target_os = "linux")), target_arch = "aarch64"))] - const _INIT: ::std::thread::__local::__impl::KeyInner<$t> = { - ::std::thread::__local::__impl::KeyInner { + const _INIT: ::std::thread::__local::KeyInner<$t> = { + ::std::thread::__local::KeyInner { inner: ::std::cell::UnsafeCell { value: $init }, - os: ::std::thread::__local::__impl::OsStaticKey { - inner: ::std::thread::__local::__impl::OS_INIT_INNER, + os: ::std::thread::__local::OsStaticKey { + inner: ::std::thread::__local::OS_INIT_INNER, dtor: ::std::option::Option::Some( - ::std::thread::__local::__impl::destroy_value::<$t> + ::std::thread::__local::destroy_value::<$t> ), }, } diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index cd480f8c29e..10c79671c0c 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -168,14 +168,6 @@ #![stable(feature = "rust1", since = "1.0.0")] -#[stable(feature = "rust1", since = "1.0.0")] -pub use self::__local::{LocalKey, LocalKeyState}; - -#[unstable(feature = "scoped_tls", - reason = "scoped TLS has yet to have wide enough use to fully consider \ - stabilizing its interface")] -pub use self::__scoped::ScopedKey; - use prelude::v1::*; use any::Any; @@ -194,13 +186,19 @@ use time::Duration; // Thread-local storage //////////////////////////////////////////////////////////////////////////////// -#[macro_use] -#[doc(hidden)] -#[path = "local.rs"] pub mod __local; +#[macro_use] mod local; +#[macro_use] mod scoped; -#[macro_use] -#[doc(hidden)] -#[path = "scoped.rs"] pub mod __scoped; +#[stable(feature = "rust1", since = "1.0.0")] +pub use self::local::{LocalKey, LocalKeyState}; + +#[unstable(feature = "scoped_tls", + reason = "scoped TLS has yet to have wide enough use to fully \ + consider stabilizing its interface")] +pub use self::scoped::ScopedKey; + +#[doc(hidden)] pub use self::local::__impl as __local; +#[doc(hidden)] pub use self::scoped::__impl as __scoped; //////////////////////////////////////////////////////////////////////////////// // Builder diff --git a/src/libstd/thread/scoped.rs b/src/libstd/thread/scoped.rs index b384879d7a9..fa980954c2f 100644 --- a/src/libstd/thread/scoped.rs +++ b/src/libstd/thread/scoped.rs @@ -110,7 +110,7 @@ macro_rules! __scoped_thread_local_inner { target_os = "openbsd", target_arch = "aarch64")))] const _INIT: __Key<$t> = __Key { - inner: ::std::thread::__scoped::__impl::KeyInner { + inner: ::std::thread::__scoped::KeyInner { inner: ::std::cell::UnsafeCell { value: 0 as *mut _ }, } }; @@ -121,8 +121,8 @@ macro_rules! __scoped_thread_local_inner { target_os = "openbsd", target_arch = "aarch64"))] const _INIT: __Key<$t> = __Key { - inner: ::std::thread::__scoped::__impl::KeyInner { - inner: ::std::thread::__scoped::__impl::OS_INIT, + inner: ::std::thread::__scoped::KeyInner { + inner: ::std::thread::__scoped::OS_INIT, marker: ::std::marker::PhantomData::<::std::cell::Cell<$t>>, } };