Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cdfafca

Browse files
committedOct 28, 2021
Use target_family = "wasm"
1 parent 9d339c2 commit cdfafca

File tree

7 files changed

+18
-35
lines changed

7 files changed

+18
-35
lines changed
 

‎library/core/src/ffi.rs

+6-12
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ impl fmt::Debug for c_void {
6262
#[cfg(any(
6363
all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64")),
6464
all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios")),
65-
target_arch = "wasm32",
66-
target_arch = "wasm64",
65+
target_family = "wasm",
6766
target_arch = "asmjs",
6867
windows
6968
))]
@@ -86,8 +85,7 @@ pub struct VaListImpl<'f> {
8685
#[cfg(any(
8786
all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64")),
8887
all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios")),
89-
target_arch = "wasm32",
90-
target_arch = "wasm64",
88+
target_family = "wasm",
9189
target_arch = "asmjs",
9290
windows
9391
))]
@@ -187,8 +185,7 @@ pub struct VaList<'a, 'f: 'a> {
187185
not(target_arch = "x86_64")
188186
),
189187
all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios")),
190-
target_arch = "wasm32",
191-
target_arch = "wasm64",
188+
target_family = "wasm",
192189
target_arch = "asmjs",
193190
windows
194191
))]
@@ -197,8 +194,7 @@ pub struct VaList<'a, 'f: 'a> {
197194
#[cfg(all(
198195
any(target_arch = "aarch64", target_arch = "powerpc", target_arch = "x86_64"),
199196
any(not(target_arch = "aarch64"), not(any(target_os = "macos", target_os = "ios"))),
200-
not(target_arch = "wasm32"),
201-
not(target_arch = "wasm64"),
197+
not(target_family = "wasm"),
202198
not(target_arch = "asmjs"),
203199
not(windows)
204200
))]
@@ -210,8 +206,7 @@ pub struct VaList<'a, 'f: 'a> {
210206
#[cfg(any(
211207
all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64")),
212208
all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios")),
213-
target_arch = "wasm32",
214-
target_arch = "wasm64",
209+
target_family = "wasm",
215210
target_arch = "asmjs",
216211
windows
217212
))]
@@ -232,8 +227,7 @@ impl<'f> VaListImpl<'f> {
232227
#[cfg(all(
233228
any(target_arch = "aarch64", target_arch = "powerpc", target_arch = "x86_64"),
234229
any(not(target_arch = "aarch64"), not(any(target_os = "macos", target_os = "ios"))),
235-
not(target_arch = "wasm32"),
236-
not(target_arch = "wasm64"),
230+
not(target_family = "wasm"),
237231
not(target_arch = "asmjs"),
238232
not(windows)
239233
))]

‎library/panic_abort/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ pub unsafe extern "C-unwind" fn __rust_start_panic(_payload: *mut &mut dyn BoxMe
117117
pub mod personalities {
118118
#[rustc_std_internal_symbol]
119119
#[cfg(not(any(
120-
all(target_arch = "wasm32", not(target_os = "emscripten")),
121-
all(target_arch = "wasm64", not(target_os = "emscripten")),
120+
all(target_family = "wasm", not(target_os = "emscripten")),
122121
all(target_os = "windows", target_env = "gnu", target_arch = "x86_64",),
123122
)))]
124123
pub extern "C" fn rust_eh_personality() {}

‎library/std/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ features = ['read_core', 'elf', 'macho', 'pe', 'unaligned', 'archive']
3535
[dev-dependencies]
3636
rand = "0.7"
3737

38-
[target.'cfg(any(all(any(target_arch = "wasm32", target_arch = "wasm64"), not(target_os = "emscripten")), all(target_vendor = "fortanix", target_env = "sgx")))'.dependencies]
38+
[target.'cfg(any(all(target_family = "wasm", not(target_os = "emscripten")), all(target_vendor = "fortanix", target_env = "sgx")))'.dependencies]
3939
dlmalloc = { version = "0.2.1", features = ['rustc-dep-of-std'] }
4040

4141
[target.x86_64-fortanix-unknown-sgx.dependencies]

‎library/std/src/sys/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ cfg_if::cfg_if! {
4040
} else if #[cfg(target_os = "wasi")] {
4141
mod wasi;
4242
pub use self::wasi::*;
43-
} else if #[cfg(any(target_arch = "wasm32", target_arch = "wasm64"))] {
43+
} else if #[cfg(target_family = "wasm")] {
4444
mod wasm;
4545
pub use self::wasm::*;
4646
} else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] {

‎library/std/src/sys_common/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ cfg_if::cfg_if! {
4040
if #[cfg(any(target_os = "l4re",
4141
target_os = "hermit",
4242
feature = "restricted-std",
43-
all(target_arch = "wasm32", not(target_os = "emscripten")),
44-
all(target_arch = "wasm64", not(target_os = "emscripten")),
43+
all(target_family = "wasm", not(target_os = "emscripten")),
4544
all(target_vendor = "fortanix", target_env = "sgx")))] {
4645
pub use crate::sys::net;
4746
} else {

‎library/std/src/thread/local.rs

+7-13
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ macro_rules! __thread_local_inner {
172172
//
173173
// FIXME(#84224) this should come after the `target_thread_local`
174174
// block.
175-
#[cfg(all(any(target_arch = "wasm32", target_arch = "wasm64"), not(target_feature = "atomics")))]
175+
#[cfg(all(target_family = "wasm", not(target_feature = "atomics")))]
176176
{
177177
static mut VAL: $t = $init;
178178
Some(&VAL)
@@ -181,10 +181,7 @@ macro_rules! __thread_local_inner {
181181
// If the platform has support for `#[thread_local]`, use it.
182182
#[cfg(all(
183183
target_thread_local,
184-
not(all(
185-
any(target_arch = "wasm32", target_arch = "wasm64"),
186-
not(target_feature = "atomics"),
187-
)),
184+
not(all(target_family = "wasm", not(target_feature = "atomics"))),
188185
))]
189186
{
190187
// If a dtor isn't needed we can do something "very raw" and
@@ -241,10 +238,7 @@ macro_rules! __thread_local_inner {
241238
// same implementation as below for os thread locals.
242239
#[cfg(all(
243240
not(target_thread_local),
244-
not(all(
245-
any(target_arch = "wasm32", target_arch = "wasm64"),
246-
not(target_feature = "atomics"),
247-
)),
241+
not(all(target_family = "wasm", not(target_feature = "atomics"))),
248242
))]
249243
{
250244
#[inline]
@@ -291,21 +285,21 @@ macro_rules! __thread_local_inner {
291285
// The issue of "should enable on Windows sometimes" is #84933
292286
#[cfg_attr(not(windows), inline)]
293287
unsafe fn __getit() -> $crate::option::Option<&'static $t> {
294-
#[cfg(all(any(target_arch = "wasm32", target_arch = "wasm64"), not(target_feature = "atomics")))]
288+
#[cfg(all(target_family = "wasm", not(target_feature = "atomics")))]
295289
static __KEY: $crate::thread::__StaticLocalKeyInner<$t> =
296290
$crate::thread::__StaticLocalKeyInner::new();
297291

298292
#[thread_local]
299293
#[cfg(all(
300294
target_thread_local,
301-
not(all(any(target_arch = "wasm32", target_arch = "wasm64"), not(target_feature = "atomics"))),
295+
not(all(target_family = "wasm", not(target_feature = "atomics"))),
302296
))]
303297
static __KEY: $crate::thread::__FastLocalKeyInner<$t> =
304298
$crate::thread::__FastLocalKeyInner::new();
305299

306300
#[cfg(all(
307301
not(target_thread_local),
308-
not(all(any(target_arch = "wasm32", target_arch = "wasm64"), not(target_feature = "atomics"))),
302+
not(all(target_family = "wasm", not(target_feature = "atomics"))),
309303
))]
310304
static __KEY: $crate::thread::__OsLocalKeyInner<$t> =
311305
$crate::thread::__OsLocalKeyInner::new();
@@ -488,7 +482,7 @@ mod lazy {
488482
/// On some platforms like wasm there's no threads, so no need to generate
489483
/// thread locals and we can instead just use plain statics!
490484
#[doc(hidden)]
491-
#[cfg(all(any(target_arch = "wasm32", target_arch = "wasm64"), not(target_feature = "atomics")))]
485+
#[cfg(all(target_family = "wasm", not(target_feature = "atomics")))]
492486
pub mod statik {
493487
use super::lazy::LazyKeyInner;
494488
use crate::fmt;

‎library/std/src/thread/mod.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,7 @@ pub use self::local::fast::Key as __FastLocalKeyInner;
200200
#[doc(hidden)]
201201
pub use self::local::os::Key as __OsLocalKeyInner;
202202
#[unstable(feature = "libstd_thread_internals", issue = "none")]
203-
#[cfg(all(
204-
any(target_arch = "wasm32", target_arch = "wasm64"),
205-
not(target_feature = "atomics")
206-
))]
203+
#[cfg(all(target_family = "wasm", not(target_feature = "atomics")))]
207204
#[doc(hidden)]
208205
pub use self::local::statik::Key as __StaticLocalKeyInner;
209206

0 commit comments

Comments
 (0)
Please sign in to comment.