1
Fork 0

on Windows, consistently pass ZST by-ref

This commit is contained in:
Ralf Jung 2025-01-08 15:32:09 +01:00
parent d760bb6603
commit 675a1036ca
4 changed files with 22 additions and 57 deletions

View file

@ -267,10 +267,8 @@ fn fn_sig_for_fn_abi<'tcx>(
#[inline]
fn conv_from_spec_abi(tcx: TyCtxt<'_>, abi: ExternAbi, c_variadic: bool) -> Conv {
let target = &tcx.sess.target;
use rustc_abi::ExternAbi::*;
match target.adjust_abi(abi, c_variadic) {
match tcx.sess.target.adjust_abi(abi, c_variadic) {
RustIntrinsic | Rust | RustCall => Conv::Rust,
// This is intentionally not using `Conv::Cold`, as that has to preserve
@ -281,37 +279,10 @@ fn conv_from_spec_abi(tcx: TyCtxt<'_>, abi: ExternAbi, c_variadic: bool) -> Conv
System { .. } => bug!("system abi should be selected elsewhere"),
EfiApi => bug!("eficall abi should be selected elsewhere"),
// See commentary in `is_abi_supported`: we map these to "C" on targets
// where they do not make sense.
Stdcall { .. } => {
if target.arch == "x86" {
Conv::X86Stdcall
} else {
Conv::C
}
}
Fastcall { .. } => {
if target.arch == "x86" {
Conv::X86Fastcall
} else {
Conv::C
}
}
Vectorcall { .. } => {
if ["x86", "x86_64"].contains(&&target.arch[..]) {
Conv::X86VectorCall
} else {
Conv::C
}
}
Thiscall { .. } => {
if target.arch == "x86" {
Conv::X86ThisCall
} else {
Conv::C
}
}
Stdcall { .. } => Conv::X86Stdcall,
Fastcall { .. } => Conv::X86Fastcall,
Vectorcall { .. } => Conv::X86VectorCall,
Thiscall { .. } => Conv::X86ThisCall,
C { .. } => Conv::C,
Unadjusted => Conv::C,
Win64 { .. } => Conv::X86_64Win64,