Skip to content

Commit c131ab3

Browse files
tests: cross-compile multi-platform ZST ABI tests
This allows them to be blessed, regardless of platform.
1 parent 11f9217 commit c131ab3

6 files changed

+50
-24
lines changed

tests/ui/abi/c-zst.rs

+32-19
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,40 @@
1-
//@ revisions: other other-linux x86_64-pc-windows-gnu s390x-linux sparc64-linux powerpc-linux
21
//@ normalize-stderr-test: "(abi|pref|unadjusted_abi_align): Align\([1-8] bytes\)" -> "$1: $$SOME_ALIGN"
2+
3+
// Ignore the ZST revisions
4+
5+
//@ revisions: aarch64-darwin
6+
//@[aarch64-darwin] compile-flags: --target aarch64-apple-darwin
7+
//@[aarch64-darwin] needs-llvm-components: aarch64
8+
9+
//@ revisions: powerpc-linux
10+
//@[powerpc-linux] compile-flags: --target powerpc-unknown-linux-gnu
11+
//@[powerpc-linux] needs-llvm-components: powerpc
12+
13+
//@ revisions: s390x-linux
14+
//@[s390x-linux] compile-flags: --target s390x-unknown-linux-gnu
15+
//@[s390x-linux] needs-llvm-components: systemz
16+
17+
//@ revisions: sparc64-linux
18+
//@[sparc64-linux] compile-flags: --target sparc64-unknown-linux-gnu
19+
//@[sparc64-linux] needs-llvm-components: sparc
20+
21+
//@ revisions: x86_64-linux
22+
//@[x86_64-linux] compile-flags: --target x86_64-unknown-linux-gnu
23+
//@[x86_64-linux] needs-llvm-components: x86
24+
25+
//@ revisions: x86_64-pc-windows-gnu
26+
//@[x86_64-pc-windows-gnu] compile-flags: --target x86_64-pc-windows-gnu
27+
//@[x86_64-pc-windows-gnu] needs-llvm-components: x86
28+
329
// ZSTs are only not ignored when the target_env is "gnu", "musl" or "uclibc". However, Rust does
430
// not currently support any other target_env on these architectures.
531

6-
// Ignore the ZST revisions
7-
//@[other] ignore-x86_64-pc-windows-gnu
8-
//@[other] ignore-linux
9-
//@[other-linux] only-linux
10-
//@[other-linux] ignore-s390x
11-
//@[other-linux] ignore-sparc64
12-
//@[other-linux] ignore-powerpc
13-
14-
// Pass the ZST indirectly revisions
15-
//@[x86_64-pc-windows-gnu] only-x86_64-pc-windows-gnu
16-
//@[s390x-linux] only-s390x
17-
//@[s390x-linux] only-linux
18-
//@[sparc64-linux] only-sparc64
19-
//@[sparc64-linux] only-linux
20-
//@[powerpc-linux] only-powerpc
21-
//@[powerpc-linux] only-linux
22-
23-
#![feature(rustc_attrs)]
32+
#![feature(lang_items, no_core, rustc_attrs)]
33+
#![no_core]
2434
#![crate_type = "lib"]
2535

36+
#[lang = "sized"]
37+
trait Sized {}
38+
2639
#[rustc_abi(debug)]
2740
extern "C" fn pass_zst(_: ()) {} //~ ERROR: fn_abi

tests/ui/abi/win64-zst.rs

+18-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
1-
//@ only-x86_64
2-
//@ revisions: other windows-gnu
31
//@ normalize-stderr-test: "(abi|pref|unadjusted_abi_align): Align\([1-8] bytes\)" -> "$1: $$SOME_ALIGN"
4-
//@[other] ignore-windows-gnu
5-
//@[windows-gnu] only-windows-gnu
2+
//@ only-x86_64
3+
4+
//@ revisions: x86_64-linux
5+
//@[x86_64-linux] compile-flags: --target x86_64-unknown-linux-gnu
6+
//@[x86_64-linux] needs-llvm-components: x86
67

7-
#![feature(rustc_attrs)]
8+
//@ revisions: x86_64-windows-gnu
9+
//@[x86_64-windows-gnu] compile-flags: --target x86_64-pc-windows-gnu
10+
//@[x86_64-windows-gnu] needs-llvm-components: x86
11+
12+
//@ revisions: x86_64-windows-msvc
13+
//@[x86_64-windows-msvc] compile-flags: --target x86_64-pc-windows-msvc
14+
//@[x86_64-windows-msvc] needs-llvm-components: x86
15+
16+
#![feature(no_core, lang_items, rustc_attrs)]
17+
#![no_core]
818
#![crate_type = "lib"]
919

20+
#[lang = "sized"]
21+
trait Sized {}
22+
1023
#[rustc_abi(debug)]
1124
extern "win64" fn pass_zst(_: ()) {} //~ ERROR: fn_abi

0 commit comments

Comments
 (0)