Skip to content

Commit a0c0f49

Browse files
committed
adjust_abi: make fallback logic for x86 ABIs a bit easier to read
1 parent a18bd8a commit a0c0f49

File tree

1 file changed

+10
-5
lines changed
  • compiler/rustc_target/src/spec

1 file changed

+10
-5
lines changed

compiler/rustc_target/src/spec/mod.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -2871,11 +2871,16 @@ impl Target {
28712871
EfiApi => C { unwind: false },
28722872

28732873
// See commentary in `is_abi_supported`.
2874-
Stdcall { .. } | Thiscall { .. } if self.arch == "x86" => abi,
2875-
Stdcall { unwind } | Thiscall { unwind } => C { unwind },
2876-
Fastcall { .. } if self.arch == "x86" => abi,
2877-
Vectorcall { .. } if ["x86", "x86_64"].contains(&&self.arch[..]) => abi,
2878-
Fastcall { unwind } | Vectorcall { unwind } => C { unwind },
2874+
Stdcall { unwind } | Thiscall { unwind } | Fastcall { unwind } => {
2875+
if self.arch == "x86" { abi } else { C { unwind } }
2876+
}
2877+
Vectorcall { unwind } => {
2878+
if ["x86", "x86_64"].contains(&&*self.arch) {
2879+
abi
2880+
} else {
2881+
C { unwind }
2882+
}
2883+
}
28792884

28802885
// The Windows x64 calling convention we use for `extern "Rust"`
28812886
// <https://learn.microsoft.com/en-us/cpp/build/x64-software-conventions#register-volatility-and-preservation>

0 commit comments

Comments
 (0)