std: Remove the curious inner module
This isn't actually necessary any more with the advent of `$crate` and changes in the compiler to expand macros to `::core::$foo` in the context of a `#![no_std]` crate. The libcore inner module was also trimmed down a bit to the bare bones.
This commit is contained in:
@@ -107,14 +107,14 @@ pub struct LocalKey<T> {
|
||||
#[cfg(not(no_elf_tls))]
|
||||
macro_rules! thread_local {
|
||||
(static $name:ident: $t:ty = $init:expr) => (
|
||||
static $name: ::std::thread::LocalKey<$t> =
|
||||
static $name: $crate::thread::LocalKey<$t> =
|
||||
__thread_local_inner!($t, $init,
|
||||
#[cfg_attr(all(any(target_os = "macos", target_os = "linux"),
|
||||
not(target_arch = "aarch64")),
|
||||
thread_local)]);
|
||||
);
|
||||
(pub static $name:ident: $t:ty = $init:expr) => (
|
||||
pub static $name: ::std::thread::LocalKey<$t> =
|
||||
pub static $name: $crate::thread::LocalKey<$t> =
|
||||
__thread_local_inner!($t, $init,
|
||||
#[cfg_attr(all(any(target_os = "macos", target_os = "linux"),
|
||||
not(target_arch = "aarch64")),
|
||||
@@ -128,11 +128,11 @@ macro_rules! thread_local {
|
||||
#[cfg(no_elf_tls)]
|
||||
macro_rules! thread_local {
|
||||
(static $name:ident: $t:ty = $init:expr) => (
|
||||
static $name: ::std::thread::LocalKey<$t> =
|
||||
static $name: $crate::thread::LocalKey<$t> =
|
||||
__thread_local_inner!($t, $init, #[]);
|
||||
);
|
||||
(pub static $name:ident: $t:ty = $init:expr) => (
|
||||
pub static $name: ::std::thread::LocalKey<$t> =
|
||||
pub static $name: $crate::thread::LocalKey<$t> =
|
||||
__thread_local_inner!($t, $init, #[]);
|
||||
);
|
||||
}
|
||||
@@ -145,11 +145,11 @@ macro_rules! thread_local {
|
||||
macro_rules! __thread_local_inner {
|
||||
($t:ty, $init:expr, #[$($attr:meta),*]) => {{
|
||||
$(#[$attr])*
|
||||
static __KEY: ::std::thread::__LocalKeyInner<$t> =
|
||||
::std::thread::__LocalKeyInner::new();
|
||||
static __KEY: $crate::thread::__LocalKeyInner<$t> =
|
||||
$crate::thread::__LocalKeyInner::new();
|
||||
fn __init() -> $t { $init }
|
||||
fn __getit() -> &'static ::std::thread::__LocalKeyInner<$t> { &__KEY }
|
||||
::std::thread::LocalKey::new(__getit, __init)
|
||||
fn __getit() -> &'static $crate::thread::__LocalKeyInner<$t> { &__KEY }
|
||||
$crate::thread::LocalKey::new(__getit, __init)
|
||||
}}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,11 +70,11 @@ pub struct ScopedKey<T> { inner: fn() -> &'static imp::KeyInner<T> }
|
||||
#[allow_internal_unstable]
|
||||
macro_rules! scoped_thread_local {
|
||||
(static $name:ident: $t:ty) => (
|
||||
static $name: ::std::thread::ScopedKey<$t> =
|
||||
static $name: $crate::thread::ScopedKey<$t> =
|
||||
__scoped_thread_local_inner!($t);
|
||||
);
|
||||
(pub static $name:ident: $t:ty) => (
|
||||
pub static $name: ::std::thread::ScopedKey<$t> =
|
||||
pub static $name: $crate::thread::ScopedKey<$t> =
|
||||
__scoped_thread_local_inner!($t);
|
||||
);
|
||||
}
|
||||
@@ -87,10 +87,10 @@ macro_rules! scoped_thread_local {
|
||||
#[cfg(no_elf_tls)]
|
||||
macro_rules! __scoped_thread_local_inner {
|
||||
($t:ty) => {{
|
||||
static _KEY: ::std::thread::__ScopedKeyInner<$t> =
|
||||
::std::thread::__ScopedKeyInner::new();
|
||||
fn _getit() -> &'static ::std::thread::__ScopedKeyInner<$t> { &_KEY }
|
||||
::std::thread::ScopedKey::new(_getit)
|
||||
static _KEY: $crate::thread::__ScopedKeyInner<$t> =
|
||||
$crate::thread::__ScopedKeyInner::new();
|
||||
fn _getit() -> &'static $crate::thread::__ScopedKeyInner<$t> { &_KEY }
|
||||
$crate::thread::ScopedKey::new(_getit)
|
||||
}}
|
||||
}
|
||||
|
||||
@@ -109,10 +109,10 @@ macro_rules! __scoped_thread_local_inner {
|
||||
target_os = "openbsd",
|
||||
target_arch = "aarch64")),
|
||||
thread_local)]
|
||||
static _KEY: ::std::thread::__ScopedKeyInner<$t> =
|
||||
::std::thread::__ScopedKeyInner::new();
|
||||
fn _getit() -> &'static ::std::thread::__ScopedKeyInner<$t> { &_KEY }
|
||||
::std::thread::ScopedKey::new(_getit)
|
||||
static _KEY: $crate::thread::__ScopedKeyInner<$t> =
|
||||
$crate::thread::__ScopedKeyInner::new();
|
||||
fn _getit() -> &'static $crate::thread::__ScopedKeyInner<$t> { &_KEY }
|
||||
$crate::thread::ScopedKey::new(_getit)
|
||||
}}
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ impl<T> ScopedKey<T> {
|
||||
no_elf_tls)))]
|
||||
#[doc(hidden)]
|
||||
mod imp {
|
||||
use std::cell::Cell;
|
||||
use cell::Cell;
|
||||
|
||||
pub struct KeyInner<T> { inner: Cell<*mut T> }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user