Skip to content

Commit

Permalink
Set target_family="wasm" for wasm targets
Browse files Browse the repository at this point in the history
  • Loading branch information
nagisa committed May 2, 2021
1 parent 4afea69 commit 1a491e2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_target/src/spec/mod.rs
Expand Up @@ -1046,7 +1046,7 @@ pub struct TargetOptions {
///
/// Common options are: "unix", "windows". Defaults to no families.
///
/// See https://doc.rust-lang.org/reference/conditional-compilation.html#target_family
/// See <https://doc.rust-lang.org/reference/conditional-compilation.html#target_family>.
pub families: Vec<String>,
/// Whether the target toolchain's ABI supports returning small structs as an integer.
pub abi_return_struct_as_int: bool,
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/wasm_base.rs
Expand Up @@ -61,6 +61,7 @@ pub fn options() -> TargetOptions {

TargetOptions {
is_like_wasm: true,
families: vec!["wasm".to_string()],

// we allow dynamic linking, but only cdylibs. Basically we allow a
// final library artifact that exports some symbols (a wasm module) but
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/cfg/cfg-family.rs
@@ -1,6 +1,6 @@
// run-pass
// build-pass
// pretty-expanded FIXME #23616
// ignore-wasm32-bare no target_family
// ignore-wasm32-bare no bare family
// ignore-sgx

#[cfg(windows)]
Expand Down
7 changes: 5 additions & 2 deletions src/test/ui/cfg/cfg-target-family.rs
@@ -1,5 +1,4 @@
// run-pass
// ignore-wasm32-bare no target_family
// build-pass
// ignore-sgx

// pretty-expanded FIXME #23616
Expand All @@ -11,3 +10,7 @@ pub fn main() {
#[cfg(target_family = "unix")]
pub fn main() {
}

#[cfg(target_family="wasm")]
pub fn main() {
}

0 comments on commit 1a491e2

Please sign in to comment.