diff options
| author | bors <bors@rust-lang.org> | 2015-04-10 16:18:44 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-04-10 16:18:44 +0000 |
| commit | c897ac04e2ebda378fd9e38f6ec0878ae3a2baf7 (patch) | |
| tree | f26b1f3541943b61937faf150f90b46e9a8f15c5 /src/libstd/thread | |
| parent | 9539627ac76ca37d617a329dbd79c50c59cf59ee (diff) | |
| parent | 445faca8441aae34c91318b6ad9e2049885af8dc (diff) | |
| download | rust-c897ac04e2ebda378fd9e38f6ec0878ae3a2baf7.tar.gz rust-c897ac04e2ebda378fd9e38f6ec0878ae3a2baf7.zip | |
Auto merge of #24177 - alexcrichton:rustdoc, r=aturon
This commit series starts out with more official test harness support for rustdoc tests, and then each commit afterwards adds a test (where appropriate). Each commit should also test and finish independently of all others (they're all pretty separable). I've uploaded a [copy of the documentation](http://people.mozilla.org/~acrichton/doc/std/) generated after all these commits were applied, and a double check on issues being closed would be greatly appreciated! I'll also browse the docs a bit and make sure nothing regressed too horribly.
Diffstat (limited to 'src/libstd/thread')
| -rw-r--r-- | src/libstd/thread/local.rs | 22 | ||||
| -rw-r--r-- | src/libstd/thread/mod.rs | 27 | ||||
| -rw-r--r-- | src/libstd/thread/scoped.rs | 6 |
3 files changed, 27 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 5fe6e80d6e9..10c79671c0c 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -99,6 +99,7 @@ //! `println!` and `panic!` for the child thread: //! //! ```rust +//! # #![allow(unused_must_use)] //! use std::thread; //! //! thread::Builder::new().name("child1".to_string()).spawn(move || { @@ -167,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; @@ -193,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>>, } }; |
