Rollup merge of #127605 - nikic:remove-extern-wasm, r=oli-obk · rust-lang/rust@fa3ce50

11

use crate::abi::{self, Abi, Align, FieldsShape, Size};

22

use crate::abi::{HasDataLayout, TyAbiInterface, TyAndLayout};

3-

use crate::spec::{self, HasTargetSpec, HasWasmCAbiOpt};

3+

use crate::spec::{self, HasTargetSpec, HasWasmCAbiOpt, WasmCAbi};

44

use rustc_macros::HashStable_Generic;

55

use rustc_span::Symbol;

66

use std::fmt;

@@ -854,7 +854,8 @@ impl<'a, Ty> FnAbi<'a, Ty> {

854854

return Ok(());

855855

}

856856857-

match &cx.target_spec().arch[..] {

857+

let spec = cx.target_spec();

858+

match &spec.arch[..] {

858859

"x86" => {

859860

let flavor = if let spec::abi::Abi::Fastcall { .. }

860861

| spec::abi::Abi::Vectorcall { .. } = abi

@@ -901,9 +902,7 @@ impl<'a, Ty> FnAbi<'a, Ty> {

901902

"sparc" => sparc::compute_abi_info(cx, self),

902903

"sparc64" => sparc64::compute_abi_info(cx, self),

903904

"nvptx64" => {

904-

if cx.target_spec().adjust_abi(cx, abi, self.c_variadic)

905-

== spec::abi::Abi::PtxKernel

906-

{

905+

if cx.target_spec().adjust_abi(abi, self.c_variadic) == spec::abi::Abi::PtxKernel {

907906

nvptx64::compute_ptx_kernel_abi_info(cx, self)

908907

} else {

909908

nvptx64::compute_abi_info(self)

@@ -912,13 +911,14 @@ impl<'a, Ty> FnAbi<'a, Ty> {

912911

"hexagon" => hexagon::compute_abi_info(self),

913912

"xtensa" => xtensa::compute_abi_info(cx, self),

914913

"riscv32" | "riscv64" => riscv::compute_abi_info(cx, self),

915-

"wasm32" | "wasm64" => {

916-

if cx.target_spec().adjust_abi(cx, abi, self.c_variadic) == spec::abi::Abi::Wasm {

914+

"wasm32" => {

915+

if spec.os == "unknown" && cx.wasm_c_abi_opt() == WasmCAbi::Legacy {

917916

wasm::compute_wasm_abi_info(self)

918917

} else {

919918

wasm::compute_c_abi_info(cx, self)

920919

}

921920

}

921+

"wasm64" => wasm::compute_c_abi_info(cx, self),

922922

"bpf" => bpf::compute_abi_info(self),

923923

arch => {

924924

return Err(AdjustForForeignAbiError::Unsupported {