]> git.lizzy.rs Git - rust.git/blob - tests/codegen/abi-repr-ext.rs
Rollup merge of #106570 - Xaeroxe:div-duration-tests, r=JohnTitor
[rust.git] / tests / codegen / abi-repr-ext.rs
1 // compile-flags: -O
2
3 // revisions:x86_64 i686 aarch64-apple aarch64-windows aarch64-linux arm riscv
4
5 //[x86_64] compile-flags: --target x86_64-unknown-uefi
6 //[x86_64] needs-llvm-components: x86
7 //[i686] compile-flags: --target i686-unknown-linux-musl
8 //[i686] needs-llvm-components: x86
9 //[aarch64-windows] compile-flags: --target aarch64-pc-windows-msvc
10 //[aarch64-windows] needs-llvm-components: aarch64
11 //[aarch64-linux] compile-flags: --target aarch64-unknown-linux-gnu
12 //[aarch64-linux] needs-llvm-components: aarch64
13 //[aarch64-apple] compile-flags: --target aarch64-apple-darwin
14 //[aarch64-apple] needs-llvm-components: aarch64
15 //[arm] compile-flags: --target armv7r-none-eabi
16 //[arm] needs-llvm-components: arm
17 //[riscv] compile-flags: --target riscv64gc-unknown-none-elf
18 //[riscv] needs-llvm-components: riscv
19
20 // See bottom of file for a corresponding C source file that is meant to yield
21 // equivalent declarations.
22 #![feature(no_core, lang_items)]
23 #![crate_type = "lib"]
24 #![no_std]
25 #![no_core]
26
27 #[lang="sized"] trait Sized { }
28 #[lang="freeze"] trait Freeze { }
29 #[lang="copy"] trait Copy { }
30
31 #[repr(i8)]
32 pub enum Type {
33     Type1 = 0,
34     Type2 = 1
35 }
36
37 // To accommodate rust#97800, one might consider writing the below as:
38 //
39 // `define{{( dso_local)?}} noundef{{( signext)?}} i8 @test()`
40 //
41 // but based on rust#80556, it seems important to actually check for the
42 // presence of the `signext` for those targets where we expect it.
43
44 // CHECK: define{{( dso_local)?}} noundef
45 // x86_64-SAME:                 signext
46 // aarch64-apple-SAME:          signext
47 // aarch64-windows-NOT: signext
48 // aarch64-linux-NOT:   signext
49 // arm-SAME:                    signext
50 // riscv-SAME:                  signext
51 // CHECK-SAME: i8 @test()
52
53
54 #[no_mangle]
55 pub extern "C" fn test() -> Type {
56     Type::Type1
57 }