1
Fork 0

Revert "Share wasm-bindgen compat abi selection code"

This reverts commit e7a056fe20.
This commit is contained in:
bjorn3 2021-01-26 11:09:06 +01:00
parent e7a056fe20
commit 36df9c55e5
2 changed files with 5 additions and 17 deletions

View file

@ -2752,7 +2752,7 @@ where
attrs attrs
}); });
if call::use_wasm_bindgen_compat_abi(target) { if target.arch == "wasm32" && target.os == "unknown" {
// wasm-bindgen depends on ABI details and is incompatible with the // wasm-bindgen depends on ABI details and is incompatible with the
// correct C ABI, so this is being kept around until wasm-bindgen // correct C ABI, so this is being kept around until wasm-bindgen
// can be fixed to work with the correct ABI. See #63649 for further // can be fixed to work with the correct ABI. See #63649 for further

View file

@ -1,6 +1,6 @@
use crate::abi::{self, Abi, Align, FieldsShape, Size}; use crate::abi::{self, Abi, Align, FieldsShape, Size};
use crate::abi::{HasDataLayout, LayoutOf, TyAndLayout, TyAndLayoutMethods}; use crate::abi::{HasDataLayout, LayoutOf, TyAndLayout, TyAndLayoutMethods};
use crate::spec::{self, HasTargetSpec, Target}; use crate::spec::{self, HasTargetSpec};
mod aarch64; mod aarch64;
mod amdgpu; mod amdgpu;
@ -631,10 +631,9 @@ impl<'a, Ty> FnAbi<'a, Ty> {
"nvptx64" => nvptx64::compute_abi_info(self), "nvptx64" => nvptx64::compute_abi_info(self),
"hexagon" => hexagon::compute_abi_info(self), "hexagon" => hexagon::compute_abi_info(self),
"riscv32" | "riscv64" => riscv::compute_abi_info(cx, self), "riscv32" | "riscv64" => riscv::compute_abi_info(cx, self),
"wasm32" => if use_wasm_bindgen_compat_abi(cx.target_spec()) { "wasm32" => match cx.target_spec().os.as_str() {
wasm32_bindgen_compat::compute_abi_info(self) "emscripten" | "wasi" => wasm32::compute_abi_info(cx, self),
} else { _ => wasm32_bindgen_compat::compute_abi_info(self),
wasm32::compute_abi_info(cx, self)
}, },
"asmjs" => wasm32::compute_abi_info(cx, self), "asmjs" => wasm32::compute_abi_info(cx, self),
a => return Err(format!("unrecognized arch \"{}\" in target specification", a)), a => return Err(format!("unrecognized arch \"{}\" in target specification", a)),
@ -643,14 +642,3 @@ impl<'a, Ty> FnAbi<'a, Ty> {
Ok(()) Ok(())
} }
} }
pub fn use_wasm_bindgen_compat_abi(target_spec: &Target) -> bool {
if target_spec.arch.as_str() == "wasm32" {
match target_spec.os.as_str() {
"emscripten" | "wasi" => false,
_ => true,
}
} else {
false
}
}