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