Skip to content

Commit 36df9c5

Browse files
committed
Revert "Share wasm-bindgen compat abi selection code"
This reverts commit e7a056f.
1 parent e7a056f commit 36df9c5

File tree

2 files changed

+5
-17
lines changed

2 files changed

+5
-17
lines changed

compiler/rustc_middle/src/ty/layout.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2752,7 +2752,7 @@ where
27522752
attrs
27532753
});
27542754

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

compiler/rustc_target/src/abi/call/mod.rs

+4-16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::abi::{self, Abi, Align, FieldsShape, Size};
22
use crate::abi::{HasDataLayout, LayoutOf, TyAndLayout, TyAndLayoutMethods};
3-
use crate::spec::{self, HasTargetSpec, Target};
3+
use crate::spec::{self, HasTargetSpec};
44

55
mod aarch64;
66
mod amdgpu;
@@ -631,10 +631,9 @@ impl<'a, Ty> FnAbi<'a, Ty> {
631631
"nvptx64" => nvptx64::compute_abi_info(self),
632632
"hexagon" => hexagon::compute_abi_info(self),
633633
"riscv32" | "riscv64" => riscv::compute_abi_info(cx, self),
634-
"wasm32" => if use_wasm_bindgen_compat_abi(cx.target_spec()) {
635-
wasm32_bindgen_compat::compute_abi_info(self)
636-
} else {
637-
wasm32::compute_abi_info(cx, self)
634+
"wasm32" => match cx.target_spec().os.as_str() {
635+
"emscripten" | "wasi" => wasm32::compute_abi_info(cx, self),
636+
_ => wasm32_bindgen_compat::compute_abi_info(self),
638637
},
639638
"asmjs" => wasm32::compute_abi_info(cx, self),
640639
a => return Err(format!("unrecognized arch \"{}\" in target specification", a)),
@@ -643,14 +642,3 @@ impl<'a, Ty> FnAbi<'a, Ty> {
643642
Ok(())
644643
}
645644
}
646-
647-
pub fn use_wasm_bindgen_compat_abi(target_spec: &Target) -> bool {
648-
if target_spec.arch.as_str() == "wasm32" {
649-
match target_spec.os.as_str() {
650-
"emscripten" | "wasi" => false,
651-
_ => true,
652-
}
653-
} else {
654-
false
655-
}
656-
}

0 commit comments

Comments
 (0)