Skip to content

Commit f651bea

Browse files
committed
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
1 parent 61d0365 commit f651bea

File tree

3 files changed

+26
-28
lines changed

3 files changed

+26
-28
lines changed

src/libstd/thread/local.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ macro_rules! thread_local {
9595
(static $name:ident: $t:ty = $init:expr) => (
9696
static $name: ::std::thread::LocalKey<$t> = {
9797
use std::cell::UnsafeCell as __UnsafeCell;
98-
use std::thread::__local::__impl::KeyInner as __KeyInner;
98+
use std::thread::__local::KeyInner as __KeyInner;
9999
use std::option::Option as __Option;
100100
use std::option::Option::None as __None;
101101

@@ -112,7 +112,7 @@ macro_rules! thread_local {
112112
(pub static $name:ident: $t:ty = $init:expr) => (
113113
pub static $name: ::std::thread::LocalKey<$t> = {
114114
use std::cell::UnsafeCell as __UnsafeCell;
115-
use std::thread::__local::__impl::KeyInner as __KeyInner;
115+
use std::thread::__local::KeyInner as __KeyInner;
116116
use std::option::Option as __Option;
117117
use std::option::Option::None as __None;
118118

@@ -156,20 +156,20 @@ macro_rules! __thread_local_inner {
156156
#[cfg_attr(all(any(target_os = "macos", target_os = "linux"),
157157
not(target_arch = "aarch64")),
158158
thread_local)]
159-
static $name: ::std::thread::__local::__impl::KeyInner<$t> =
159+
static $name: ::std::thread::__local::KeyInner<$t> =
160160
__thread_local_inner!($init, $t);
161161
);
162162
(pub static $name:ident: $t:ty = $init:expr) => (
163163
#[cfg_attr(all(any(target_os = "macos", target_os = "linux"),
164164
not(target_arch = "aarch64")),
165165
thread_local)]
166-
pub static $name: ::std::thread::__local::__impl::KeyInner<$t> =
166+
pub static $name: ::std::thread::__local::KeyInner<$t> =
167167
__thread_local_inner!($init, $t);
168168
);
169169
($init:expr, $t:ty) => ({
170170
#[cfg(all(any(target_os = "macos", target_os = "linux"), not(target_arch = "aarch64")))]
171-
const _INIT: ::std::thread::__local::__impl::KeyInner<$t> = {
172-
::std::thread::__local::__impl::KeyInner {
171+
const _INIT: ::std::thread::__local::KeyInner<$t> = {
172+
::std::thread::__local::KeyInner {
173173
inner: ::std::cell::UnsafeCell { value: $init },
174174
dtor_registered: ::std::cell::UnsafeCell { value: false },
175175
dtor_running: ::std::cell::UnsafeCell { value: false },
@@ -178,13 +178,13 @@ macro_rules! __thread_local_inner {
178178

179179
#[allow(trivial_casts)]
180180
#[cfg(any(not(any(target_os = "macos", target_os = "linux")), target_arch = "aarch64"))]
181-
const _INIT: ::std::thread::__local::__impl::KeyInner<$t> = {
182-
::std::thread::__local::__impl::KeyInner {
181+
const _INIT: ::std::thread::__local::KeyInner<$t> = {
182+
::std::thread::__local::KeyInner {
183183
inner: ::std::cell::UnsafeCell { value: $init },
184-
os: ::std::thread::__local::__impl::OsStaticKey {
185-
inner: ::std::thread::__local::__impl::OS_INIT_INNER,
184+
os: ::std::thread::__local::OsStaticKey {
185+
inner: ::std::thread::__local::OS_INIT_INNER,
186186
dtor: ::std::option::Option::Some(
187-
::std::thread::__local::__impl::destroy_value::<$t>
187+
::std::thread::__local::destroy_value::<$t>
188188
),
189189
},
190190
}

src/libstd/thread/mod.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,6 @@
168168
169169
#![stable(feature = "rust1", since = "1.0.0")]
170170

171-
#[stable(feature = "rust1", since = "1.0.0")]
172-
pub use self::__local::{LocalKey, LocalKeyState};
173-
174-
#[unstable(feature = "scoped_tls",
175-
reason = "scoped TLS has yet to have wide enough use to fully consider \
176-
stabilizing its interface")]
177-
pub use self::__scoped::ScopedKey;
178-
179171
use prelude::v1::*;
180172

181173
use any::Any;
@@ -194,13 +186,19 @@ use time::Duration;
194186
// Thread-local storage
195187
////////////////////////////////////////////////////////////////////////////////
196188

197-
#[macro_use]
198-
#[doc(hidden)]
199-
#[path = "local.rs"] pub mod __local;
189+
#[macro_use] mod local;
190+
#[macro_use] mod scoped;
191+
192+
#[stable(feature = "rust1", since = "1.0.0")]
193+
pub use self::local::{LocalKey, LocalKeyState};
194+
195+
#[unstable(feature = "scoped_tls",
196+
reason = "scoped TLS has yet to have wide enough use to fully \
197+
consider stabilizing its interface")]
198+
pub use self::scoped::ScopedKey;
200199

201-
#[macro_use]
202-
#[doc(hidden)]
203-
#[path = "scoped.rs"] pub mod __scoped;
200+
#[doc(hidden)] pub use self::local::__impl as __local;
201+
#[doc(hidden)] pub use self::scoped::__impl as __scoped;
204202

205203
////////////////////////////////////////////////////////////////////////////////
206204
// Builder

src/libstd/thread/scoped.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ macro_rules! __scoped_thread_local_inner {
110110
target_os = "openbsd",
111111
target_arch = "aarch64")))]
112112
const _INIT: __Key<$t> = __Key {
113-
inner: ::std::thread::__scoped::__impl::KeyInner {
113+
inner: ::std::thread::__scoped::KeyInner {
114114
inner: ::std::cell::UnsafeCell { value: 0 as *mut _ },
115115
}
116116
};
@@ -121,8 +121,8 @@ macro_rules! __scoped_thread_local_inner {
121121
target_os = "openbsd",
122122
target_arch = "aarch64"))]
123123
const _INIT: __Key<$t> = __Key {
124-
inner: ::std::thread::__scoped::__impl::KeyInner {
125-
inner: ::std::thread::__scoped::__impl::OS_INIT,
124+
inner: ::std::thread::__scoped::KeyInner {
125+
inner: ::std::thread::__scoped::OS_INIT,
126126
marker: ::std::marker::PhantomData::<::std::cell::Cell<$t>>,
127127
}
128128
};

0 commit comments

Comments
 (0)