]> git.lizzy.rs Git - rust.git/blob - tests/codegen/repr-transparent-aggregates-2.rs
Auto merge of #106520 - ehuss:update-mdbook, r=Mark-Simulacrum
[rust.git] / tests / codegen / repr-transparent-aggregates-2.rs
1 // compile-flags: -C no-prepopulate-passes
2 //
3
4 // ignore-aarch64
5 // ignore-emscripten
6 // ignore-mips64
7 // ignore-powerpc
8 // ignore-powerpc64
9 // ignore-powerpc64le
10 // ignore-riscv64 see codegen/riscv-abi
11 // ignore-s390x
12 // ignore-sparc
13 // ignore-sparc64
14 // ignore-x86
15 // ignore-x86_64
16 // See repr-transparent.rs
17
18 #![feature(transparent_unions)]
19
20 #![crate_type="lib"]
21
22
23 #[derive(Clone, Copy)]
24 #[repr(C)]
25 pub struct BigS([u32; 16]);
26
27 #[repr(transparent)]
28 pub struct TsBigS(BigS);
29
30 #[repr(transparent)]
31 pub union TuBigS {
32     field: BigS,
33 }
34
35 #[repr(transparent)]
36 pub enum TeBigS {
37     Variant(BigS),
38 }
39
40 // CHECK: define void @test_BigS({{%BigS\*|ptr}} [[BIGS_RET_ATTRS1:.*]] sret(%BigS) [[BIGS_RET_ATTRS2:.*]], [16 x i32]
41 #[no_mangle]
42 pub extern fn test_BigS(_: BigS) -> BigS { loop {} }
43
44 // CHECK: define void @test_TsBigS({{%TsBigS\*|ptr}} [[BIGS_RET_ATTRS1]] sret(%TsBigS) [[BIGS_RET_ATTRS2]], [16 x i32]
45 #[no_mangle]
46 pub extern fn test_TsBigS(_: TsBigS) -> TsBigS { loop {} }
47
48 // CHECK: define void @test_TuBigS({{%TuBigS\*|ptr}} [[BIGS_RET_ATTRS1]] sret(%TuBigS) [[BIGS_RET_ATTRS2]], [16 x i32]
49 #[no_mangle]
50 pub extern fn test_TuBigS(_: TuBigS) -> TuBigS { loop {} }
51
52 // CHECK: define void @test_TeBigS({{%"TeBigS::Variant"\*|ptr}} [[BIGS_RET_ATTRS1]] sret(%"TeBigS::Variant") [[BIGS_RET_ATTRS2]], [16 x i32]
53 #[no_mangle]
54 pub extern fn test_TeBigS(_: TeBigS) -> TeBigS { loop {} }
55
56
57 #[derive(Clone, Copy)]
58 #[repr(C)]
59 pub union BigU {
60     foo: [u32; 16],
61 }
62
63 #[repr(transparent)]
64 pub struct TsBigU(BigU);
65
66 #[repr(transparent)]
67 pub union TuBigU {
68     field: BigU,
69 }
70
71 #[repr(transparent)]
72 pub enum TeBigU {
73     Variant(BigU),
74 }
75
76 // CHECK: define void @test_BigU({{%BigU\*|ptr}} [[BIGU_RET_ATTRS1:.*]] sret(%BigU) [[BIGU_RET_ATTRS2:.*]], [16 x i32]
77 #[no_mangle]
78 pub extern fn test_BigU(_: BigU) -> BigU { loop {} }
79
80 // CHECK: define void @test_TsBigU({{%TsBigU\*|ptr}} [[BIGU_RET_ATTRS1]] sret(%TsBigU) [[BIGU_RET_ATTRS2]], [16 x i32]
81 #[no_mangle]
82 pub extern fn test_TsBigU(_: TsBigU) -> TsBigU { loop {} }
83
84 // CHECK: define void @test_TuBigU({{%TuBigU\*|ptr}} [[BIGU_RET_ATTRS1]] sret(%TuBigU) [[BIGU_RET_ATTRS2]], [16 x i32]
85 #[no_mangle]
86 pub extern fn test_TuBigU(_: TuBigU) -> TuBigU { loop {} }
87
88 // CHECK: define void @test_TeBigU({{%"TeBigU::Variant"\*|ptr}} [[BIGU_RET_ATTRS1]] sret(%"TeBigU::Variant") [[BIGU_RET_ATTRS2]], [16 x i32]
89 #[no_mangle]
90 pub extern fn test_TeBigU(_: TeBigU) -> TeBigU { loop {} }