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