Skip to content

Commit 1febf58

Browse files
committed
justify adjust_abi behavior with ms docs
1 parent fbcbdb0 commit 1febf58

File tree

1 file changed

+4
-0
lines changed
  • compiler/rustc_target/src/spec

1 file changed

+4
-0
lines changed

compiler/rustc_target/src/spec/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -2402,6 +2402,10 @@ impl Target {
24022402
pub fn adjust_abi(&self, abi: Abi, c_variadic: bool) -> Abi {
24032403
match abi {
24042404
Abi::C { .. } => self.default_adjusted_cabi.unwrap_or(abi),
2405+
2406+
// On Windows, `extern "system"` behaves like msvc's `__stdcall`
2407+
// `__stdcall` only applies on x86 and on non-variadic functions
2408+
// see https://learn.microsoft.com/en-us/cpp/cpp/stdcall?view=msvc-170
24052409
Abi::System { unwind } if self.is_like_windows && self.arch == "x86" && !c_variadic => {
24062410
Abi::Stdcall { unwind }
24072411
}

0 commit comments

Comments
 (0)