diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-04-07 17:10:09 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-04-07 17:54:35 -0700 |
| commit | f651bea822c7c1b1dcc317e089709804a97e2236 (patch) | |
| tree | fdbf2a5c7347baeba9f63bbf14d9a8e2777dbd03 /src/libstd/thread | |
| parent | 61d0365aacbf9c2729d78032e88138d07e5f15bb (diff) | |
| download | rust-f651bea822c7c1b1dcc317e089709804a97e2236.tar.gz rust-f651bea822c7c1b1dcc317e089709804a97e2236.zip | |
std: Reorganize thread::local a bit
Make the structure more amenable to what rustdoc is expecting to ensure that everything renders all nice and pretty in the output. Closes #23705 Closes #23910
Diffstat (limited to 'src/libstd/thread')
| -rw-r--r-- | src/libstd/thread/local.rs | 22 | ||||
| -rw-r--r-- | src/libstd/thread/mod.rs | 26 | ||||
| -rw-r--r-- | src/libstd/thread/scoped.rs | 6 |
3 files changed, 26 insertions, 28 deletions
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; + +#[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; -#[macro_use] -#[doc(hidden)] -#[path = "scoped.rs"] pub mod __scoped; +#[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>>, } }; |
