Set target_family="wasm" for wasm targets

This commit is contained in:
Simonas Kazlauskas 2021-04-10 23:28:58 +03:00
parent 4afea69090
commit 1a491e2304
4 changed files with 9 additions and 5 deletions

View File

@ -1046,7 +1046,7 @@ pub struct TargetOptions {
/// ///
/// Common options are: "unix", "windows". Defaults to no families. /// 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>, pub families: Vec<String>,
/// Whether the target toolchain's ABI supports returning small structs as an integer. /// Whether the target toolchain's ABI supports returning small structs as an integer.
pub abi_return_struct_as_int: bool, pub abi_return_struct_as_int: bool,

View File

@ -61,6 +61,7 @@ pub fn options() -> TargetOptions {
TargetOptions { TargetOptions {
is_like_wasm: true, is_like_wasm: true,
families: vec!["wasm".to_string()],
// we allow dynamic linking, but only cdylibs. Basically we allow a // we allow dynamic linking, but only cdylibs. Basically we allow a
// final library artifact that exports some symbols (a wasm module) but // final library artifact that exports some symbols (a wasm module) but

View File

@ -1,6 +1,6 @@
// run-pass // build-pass
// pretty-expanded FIXME #23616 // pretty-expanded FIXME #23616
// ignore-wasm32-bare no target_family // ignore-wasm32-bare no bare family
// ignore-sgx // ignore-sgx
#[cfg(windows)] #[cfg(windows)]

View File

@ -1,5 +1,4 @@
// run-pass // build-pass
// ignore-wasm32-bare no target_family
// ignore-sgx // ignore-sgx
// pretty-expanded FIXME #23616 // pretty-expanded FIXME #23616
@ -11,3 +10,7 @@ pub fn main() {
#[cfg(target_family = "unix")] #[cfg(target_family = "unix")]
pub fn main() { pub fn main() {
} }
#[cfg(target_family="wasm")]
pub fn main() {
}