Skip to content

Commit 40abd58

Browse files
committed
turn this into a codegen test so that we actually ensure it behaves correctly
1 parent 6241d35 commit 40abd58

File tree

5 files changed

+33
-227
lines changed

5 files changed

+33
-227
lines changed

tests/codegen/abi-win64-zst.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//@ revisions: linux
2+
//@[linux] compile-flags: --target x86_64-unknown-linux-gnu
3+
//@[linux] needs-llvm-components: x86
4+
5+
//@ revisions: windows-gnu
6+
//@[windows-gnu] compile-flags: --target x86_64-pc-windows-gnu
7+
//@[windows-gnu] needs-llvm-components: x86
8+
9+
//@ revisions: windows-msvc
10+
//@[windows-msvc] compile-flags: --target x86_64-pc-windows-msvc
11+
//@[windows-msvc] needs-llvm-components: x86
12+
13+
#![feature(no_core, lang_items, rustc_attrs)]
14+
#![no_core]
15+
#![crate_type = "lib"]
16+
17+
#[lang = "sized"]
18+
trait Sized {}
19+
20+
// Make sure the argument is always ignored when explicitly requesting "win64" ABI.
21+
22+
// CHECK: define win64cc void @pass_zst_win64()
23+
#[no_mangle]
24+
extern "win64" fn pass_zst_win64(_: ()) {}
25+
26+
// For `extern "C"` functions, ZST are *not* ignored on windows-gnu.
27+
// That's likely an accident on their side but the ABI is what it is.
28+
29+
// linux: define void @pass_zst_c()
30+
// windows-msvc: define void @pass_zst_c()
31+
// windows-gnu: define void @pass_zst_c(ptr {{.*}})
32+
#[no_mangle]
33+
extern "C" fn pass_zst_c(_: ()) {}

tests/ui/abi/win64-zst.rs

Lines changed: 0 additions & 26 deletions
This file was deleted.

tests/ui/abi/win64-zst.x86_64-linux.stderr

Lines changed: 0 additions & 67 deletions
This file was deleted.

tests/ui/abi/win64-zst.x86_64-windows-gnu.stderr

Lines changed: 0 additions & 67 deletions
This file was deleted.

tests/ui/abi/win64-zst.x86_64-windows-msvc.stderr

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)