Use target_family = "wasm"
This commit is contained in:
parent
cfb2f98e9e
commit
971638824f
7 changed files with 18 additions and 35 deletions
|
@ -62,8 +62,7 @@ impl fmt::Debug for c_void {
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64")),
|
all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64")),
|
||||||
all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios")),
|
all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios")),
|
||||||
target_arch = "wasm32",
|
target_family = "wasm",
|
||||||
target_arch = "wasm64",
|
|
||||||
target_arch = "asmjs",
|
target_arch = "asmjs",
|
||||||
windows
|
windows
|
||||||
))]
|
))]
|
||||||
|
@ -86,8 +85,7 @@ pub struct VaListImpl<'f> {
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64")),
|
all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64")),
|
||||||
all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios")),
|
all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios")),
|
||||||
target_arch = "wasm32",
|
target_family = "wasm",
|
||||||
target_arch = "wasm64",
|
|
||||||
target_arch = "asmjs",
|
target_arch = "asmjs",
|
||||||
windows
|
windows
|
||||||
))]
|
))]
|
||||||
|
@ -187,8 +185,7 @@ pub struct VaList<'a, 'f: 'a> {
|
||||||
not(target_arch = "x86_64")
|
not(target_arch = "x86_64")
|
||||||
),
|
),
|
||||||
all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios")),
|
all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios")),
|
||||||
target_arch = "wasm32",
|
target_family = "wasm",
|
||||||
target_arch = "wasm64",
|
|
||||||
target_arch = "asmjs",
|
target_arch = "asmjs",
|
||||||
windows
|
windows
|
||||||
))]
|
))]
|
||||||
|
@ -197,8 +194,7 @@ pub struct VaList<'a, 'f: 'a> {
|
||||||
#[cfg(all(
|
#[cfg(all(
|
||||||
any(target_arch = "aarch64", target_arch = "powerpc", target_arch = "x86_64"),
|
any(target_arch = "aarch64", target_arch = "powerpc", target_arch = "x86_64"),
|
||||||
any(not(target_arch = "aarch64"), not(any(target_os = "macos", target_os = "ios"))),
|
any(not(target_arch = "aarch64"), not(any(target_os = "macos", target_os = "ios"))),
|
||||||
not(target_arch = "wasm32"),
|
not(target_family = "wasm"),
|
||||||
not(target_arch = "wasm64"),
|
|
||||||
not(target_arch = "asmjs"),
|
not(target_arch = "asmjs"),
|
||||||
not(windows)
|
not(windows)
|
||||||
))]
|
))]
|
||||||
|
@ -210,8 +206,7 @@ pub struct VaList<'a, 'f: 'a> {
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64")),
|
all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64")),
|
||||||
all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios")),
|
all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios")),
|
||||||
target_arch = "wasm32",
|
target_family = "wasm",
|
||||||
target_arch = "wasm64",
|
|
||||||
target_arch = "asmjs",
|
target_arch = "asmjs",
|
||||||
windows
|
windows
|
||||||
))]
|
))]
|
||||||
|
@ -232,8 +227,7 @@ impl<'f> VaListImpl<'f> {
|
||||||
#[cfg(all(
|
#[cfg(all(
|
||||||
any(target_arch = "aarch64", target_arch = "powerpc", target_arch = "x86_64"),
|
any(target_arch = "aarch64", target_arch = "powerpc", target_arch = "x86_64"),
|
||||||
any(not(target_arch = "aarch64"), not(any(target_os = "macos", target_os = "ios"))),
|
any(not(target_arch = "aarch64"), not(any(target_os = "macos", target_os = "ios"))),
|
||||||
not(target_arch = "wasm32"),
|
not(target_family = "wasm"),
|
||||||
not(target_arch = "wasm64"),
|
|
||||||
not(target_arch = "asmjs"),
|
not(target_arch = "asmjs"),
|
||||||
not(windows)
|
not(windows)
|
||||||
))]
|
))]
|
||||||
|
|
|
@ -117,8 +117,7 @@ pub unsafe extern "C-unwind" fn __rust_start_panic(_payload: *mut &mut dyn BoxMe
|
||||||
pub mod personalities {
|
pub mod personalities {
|
||||||
#[rustc_std_internal_symbol]
|
#[rustc_std_internal_symbol]
|
||||||
#[cfg(not(any(
|
#[cfg(not(any(
|
||||||
all(target_arch = "wasm32", not(target_os = "emscripten")),
|
all(target_family = "wasm", not(target_os = "emscripten")),
|
||||||
all(target_arch = "wasm64", not(target_os = "emscripten")),
|
|
||||||
all(target_os = "windows", target_env = "gnu", target_arch = "x86_64",),
|
all(target_os = "windows", target_env = "gnu", target_arch = "x86_64",),
|
||||||
)))]
|
)))]
|
||||||
pub extern "C" fn rust_eh_personality() {}
|
pub extern "C" fn rust_eh_personality() {}
|
||||||
|
|
|
@ -35,7 +35,7 @@ features = ['read_core', 'elf', 'macho', 'pe', 'unaligned', 'archive']
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
rand = "0.7"
|
rand = "0.7"
|
||||||
|
|
||||||
[target.'cfg(any(all(any(target_arch = "wasm32", target_arch = "wasm64"), not(target_os = "emscripten")), all(target_vendor = "fortanix", target_env = "sgx")))'.dependencies]
|
[target.'cfg(any(all(target_family = "wasm", not(target_os = "emscripten")), all(target_vendor = "fortanix", target_env = "sgx")))'.dependencies]
|
||||||
dlmalloc = { version = "0.2.1", features = ['rustc-dep-of-std'] }
|
dlmalloc = { version = "0.2.1", features = ['rustc-dep-of-std'] }
|
||||||
|
|
||||||
[target.x86_64-fortanix-unknown-sgx.dependencies]
|
[target.x86_64-fortanix-unknown-sgx.dependencies]
|
||||||
|
|
|
@ -40,7 +40,7 @@ cfg_if::cfg_if! {
|
||||||
} else if #[cfg(target_os = "wasi")] {
|
} else if #[cfg(target_os = "wasi")] {
|
||||||
mod wasi;
|
mod wasi;
|
||||||
pub use self::wasi::*;
|
pub use self::wasi::*;
|
||||||
} else if #[cfg(any(target_arch = "wasm32", target_arch = "wasm64"))] {
|
} else if #[cfg(target_family = "wasm")] {
|
||||||
mod wasm;
|
mod wasm;
|
||||||
pub use self::wasm::*;
|
pub use self::wasm::*;
|
||||||
} else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] {
|
} else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] {
|
||||||
|
|
|
@ -40,8 +40,7 @@ cfg_if::cfg_if! {
|
||||||
if #[cfg(any(target_os = "l4re",
|
if #[cfg(any(target_os = "l4re",
|
||||||
target_os = "hermit",
|
target_os = "hermit",
|
||||||
feature = "restricted-std",
|
feature = "restricted-std",
|
||||||
all(target_arch = "wasm32", not(target_os = "emscripten")),
|
all(target_family = "wasm", not(target_os = "emscripten")),
|
||||||
all(target_arch = "wasm64", not(target_os = "emscripten")),
|
|
||||||
all(target_vendor = "fortanix", target_env = "sgx")))] {
|
all(target_vendor = "fortanix", target_env = "sgx")))] {
|
||||||
pub use crate::sys::net;
|
pub use crate::sys::net;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -172,7 +172,7 @@ macro_rules! __thread_local_inner {
|
||||||
//
|
//
|
||||||
// FIXME(#84224) this should come after the `target_thread_local`
|
// FIXME(#84224) this should come after the `target_thread_local`
|
||||||
// block.
|
// block.
|
||||||
#[cfg(all(any(target_arch = "wasm32", target_arch = "wasm64"), not(target_feature = "atomics")))]
|
#[cfg(all(target_family = "wasm", not(target_feature = "atomics")))]
|
||||||
{
|
{
|
||||||
static mut VAL: $t = $init;
|
static mut VAL: $t = $init;
|
||||||
Some(&VAL)
|
Some(&VAL)
|
||||||
|
@ -181,10 +181,7 @@ macro_rules! __thread_local_inner {
|
||||||
// If the platform has support for `#[thread_local]`, use it.
|
// If the platform has support for `#[thread_local]`, use it.
|
||||||
#[cfg(all(
|
#[cfg(all(
|
||||||
target_thread_local,
|
target_thread_local,
|
||||||
not(all(
|
not(all(target_family = "wasm", not(target_feature = "atomics"))),
|
||||||
any(target_arch = "wasm32", target_arch = "wasm64"),
|
|
||||||
not(target_feature = "atomics"),
|
|
||||||
)),
|
|
||||||
))]
|
))]
|
||||||
{
|
{
|
||||||
// If a dtor isn't needed we can do something "very raw" and
|
// If a dtor isn't needed we can do something "very raw" and
|
||||||
|
@ -241,10 +238,7 @@ macro_rules! __thread_local_inner {
|
||||||
// same implementation as below for os thread locals.
|
// same implementation as below for os thread locals.
|
||||||
#[cfg(all(
|
#[cfg(all(
|
||||||
not(target_thread_local),
|
not(target_thread_local),
|
||||||
not(all(
|
not(all(target_family = "wasm", not(target_feature = "atomics"))),
|
||||||
any(target_arch = "wasm32", target_arch = "wasm64"),
|
|
||||||
not(target_feature = "atomics"),
|
|
||||||
)),
|
|
||||||
))]
|
))]
|
||||||
{
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -291,21 +285,21 @@ macro_rules! __thread_local_inner {
|
||||||
// The issue of "should enable on Windows sometimes" is #84933
|
// The issue of "should enable on Windows sometimes" is #84933
|
||||||
#[cfg_attr(not(windows), inline)]
|
#[cfg_attr(not(windows), inline)]
|
||||||
unsafe fn __getit() -> $crate::option::Option<&'static $t> {
|
unsafe fn __getit() -> $crate::option::Option<&'static $t> {
|
||||||
#[cfg(all(any(target_arch = "wasm32", target_arch = "wasm64"), not(target_feature = "atomics")))]
|
#[cfg(all(target_family = "wasm", not(target_feature = "atomics")))]
|
||||||
static __KEY: $crate::thread::__StaticLocalKeyInner<$t> =
|
static __KEY: $crate::thread::__StaticLocalKeyInner<$t> =
|
||||||
$crate::thread::__StaticLocalKeyInner::new();
|
$crate::thread::__StaticLocalKeyInner::new();
|
||||||
|
|
||||||
#[thread_local]
|
#[thread_local]
|
||||||
#[cfg(all(
|
#[cfg(all(
|
||||||
target_thread_local,
|
target_thread_local,
|
||||||
not(all(any(target_arch = "wasm32", target_arch = "wasm64"), not(target_feature = "atomics"))),
|
not(all(target_family = "wasm", not(target_feature = "atomics"))),
|
||||||
))]
|
))]
|
||||||
static __KEY: $crate::thread::__FastLocalKeyInner<$t> =
|
static __KEY: $crate::thread::__FastLocalKeyInner<$t> =
|
||||||
$crate::thread::__FastLocalKeyInner::new();
|
$crate::thread::__FastLocalKeyInner::new();
|
||||||
|
|
||||||
#[cfg(all(
|
#[cfg(all(
|
||||||
not(target_thread_local),
|
not(target_thread_local),
|
||||||
not(all(any(target_arch = "wasm32", target_arch = "wasm64"), not(target_feature = "atomics"))),
|
not(all(target_family = "wasm", not(target_feature = "atomics"))),
|
||||||
))]
|
))]
|
||||||
static __KEY: $crate::thread::__OsLocalKeyInner<$t> =
|
static __KEY: $crate::thread::__OsLocalKeyInner<$t> =
|
||||||
$crate::thread::__OsLocalKeyInner::new();
|
$crate::thread::__OsLocalKeyInner::new();
|
||||||
|
@ -488,7 +482,7 @@ mod lazy {
|
||||||
/// On some platforms like wasm there's no threads, so no need to generate
|
/// On some platforms like wasm there's no threads, so no need to generate
|
||||||
/// thread locals and we can instead just use plain statics!
|
/// thread locals and we can instead just use plain statics!
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[cfg(all(any(target_arch = "wasm32", target_arch = "wasm64"), not(target_feature = "atomics")))]
|
#[cfg(all(target_family = "wasm", not(target_feature = "atomics")))]
|
||||||
pub mod statik {
|
pub mod statik {
|
||||||
use super::lazy::LazyKeyInner;
|
use super::lazy::LazyKeyInner;
|
||||||
use crate::fmt;
|
use crate::fmt;
|
||||||
|
|
|
@ -200,10 +200,7 @@ pub use self::local::fast::Key as __FastLocalKeyInner;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub use self::local::os::Key as __OsLocalKeyInner;
|
pub use self::local::os::Key as __OsLocalKeyInner;
|
||||||
#[unstable(feature = "libstd_thread_internals", issue = "none")]
|
#[unstable(feature = "libstd_thread_internals", issue = "none")]
|
||||||
#[cfg(all(
|
#[cfg(all(target_family = "wasm", not(target_feature = "atomics")))]
|
||||||
any(target_arch = "wasm32", target_arch = "wasm64"),
|
|
||||||
not(target_feature = "atomics")
|
|
||||||
))]
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub use self::local::statik::Key as __StaticLocalKeyInner;
|
pub use self::local::statik::Key as __StaticLocalKeyInner;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue