@@ -19,36 +19,36 @@ pub struct F32(f32);
19
19
20
20
// CHECK: define float @test_F32(float %_1)
21
21
#[ no_mangle]
22
- pub extern fn test_F32 ( _: F32 ) -> F32 { loop { } }
22
+ pub extern "C" fn test_F32 ( _: F32 ) -> F32 { loop { } }
23
23
24
24
#[ repr( transparent) ]
25
25
pub struct Ptr ( * mut u8 ) ;
26
26
27
27
// CHECK: define i8* @test_Ptr(i8* %_1)
28
28
#[ no_mangle]
29
- pub extern fn test_Ptr ( _: Ptr ) -> Ptr { loop { } }
29
+ pub extern "C" fn test_Ptr ( _: Ptr ) -> Ptr { loop { } }
30
30
31
31
#[ repr( transparent) ]
32
32
pub struct WithZst ( u64 , Zst1 ) ;
33
33
34
34
// CHECK: define i64 @test_WithZst(i64 %_1)
35
35
#[ no_mangle]
36
- pub extern fn test_WithZst ( _: WithZst ) -> WithZst { loop { } }
36
+ pub extern "C" fn test_WithZst ( _: WithZst ) -> WithZst { loop { } }
37
37
38
38
#[ repr( transparent) ]
39
39
pub struct WithZeroSizedArray ( * const f32 , [ i8 ; 0 ] ) ;
40
40
41
41
// Apparently we use i32* when newtype-unwrapping f32 pointers. Whatever.
42
42
// CHECK: define i32* @test_WithZeroSizedArray(i32* %_1)
43
43
#[ no_mangle]
44
- pub extern fn test_WithZeroSizedArray ( _: WithZeroSizedArray ) -> WithZeroSizedArray { loop { } }
44
+ pub extern "C" fn test_WithZeroSizedArray ( _: WithZeroSizedArray ) -> WithZeroSizedArray { loop { } }
45
45
46
46
#[ repr( transparent) ]
47
47
pub struct Generic < T > ( T ) ;
48
48
49
49
// CHECK: define double @test_Generic(double %_1)
50
50
#[ no_mangle]
51
- pub extern fn test_Generic ( _: Generic < f64 > ) -> Generic < f64 > { loop { } }
51
+ pub extern "C" fn test_Generic ( _: Generic < f64 > ) -> Generic < f64 > { loop { } }
52
52
53
53
#[ repr( transparent) ]
54
54
pub struct GenericPlusZst < T > ( T , Zst2 ) ;
@@ -58,14 +58,14 @@ pub enum Bool { True, False, FileNotFound }
58
58
59
59
// CHECK: define{{( zeroext)?}} i8 @test_Gpz(i8{{( zeroext)?}} %_1)
60
60
#[ no_mangle]
61
- pub extern fn test_Gpz ( _: GenericPlusZst < Bool > ) -> GenericPlusZst < Bool > { loop { } }
61
+ pub extern "C" fn test_Gpz ( _: GenericPlusZst < Bool > ) -> GenericPlusZst < Bool > { loop { } }
62
62
63
63
#[ repr( transparent) ]
64
64
pub struct LifetimePhantom < ' a , T : ' a > ( * const T , PhantomData < & ' a T > ) ;
65
65
66
66
// CHECK: define i16* @test_LifetimePhantom(i16* %_1)
67
67
#[ no_mangle]
68
- pub extern fn test_LifetimePhantom ( _: LifetimePhantom < i16 > ) -> LifetimePhantom < i16 > { loop { } }
68
+ pub extern "C" fn test_LifetimePhantom ( _: LifetimePhantom < i16 > ) -> LifetimePhantom < i16 > { loop { } }
69
69
70
70
// This works despite current alignment resrictions because PhantomData is always align(1)
71
71
#[ repr( transparent) ]
@@ -75,28 +75,28 @@ pub struct Px;
75
75
76
76
// CHECK: define float @test_UnitPhantom(float %_1)
77
77
#[ no_mangle]
78
- pub extern fn test_UnitPhantom ( _: UnitPhantom < f32 , Px > ) -> UnitPhantom < f32 , Px > { loop { } }
78
+ pub extern "C" fn test_UnitPhantom ( _: UnitPhantom < f32 , Px > ) -> UnitPhantom < f32 , Px > { loop { } }
79
79
80
80
#[ repr( transparent) ]
81
81
pub struct TwoZsts ( Zst1 , i8 , Zst2 ) ;
82
82
83
83
// CHECK: define{{( signext)?}} i8 @test_TwoZsts(i8{{( signext)?}} %_1)
84
84
#[ no_mangle]
85
- pub extern fn test_TwoZsts ( _: TwoZsts ) -> TwoZsts { loop { } }
85
+ pub extern "C" fn test_TwoZsts ( _: TwoZsts ) -> TwoZsts { loop { } }
86
86
87
87
#[ repr( transparent) ]
88
88
pub struct Nested1 ( Zst2 , Generic < f64 > ) ;
89
89
90
90
// CHECK: define double @test_Nested1(double %_1)
91
91
#[ no_mangle]
92
- pub extern fn test_Nested1 ( _: Nested1 ) -> Nested1 { loop { } }
92
+ pub extern "C" fn test_Nested1 ( _: Nested1 ) -> Nested1 { loop { } }
93
93
94
94
#[ repr( transparent) ]
95
95
pub struct Nested2 ( Nested1 , Zst1 ) ;
96
96
97
97
// CHECK: define double @test_Nested2(double %_1)
98
98
#[ no_mangle]
99
- pub extern fn test_Nested2 ( _: Nested2 ) -> Nested2 { loop { } }
99
+ pub extern "C" fn test_Nested2 ( _: Nested2 ) -> Nested2 { loop { } }
100
100
101
101
#[ repr( simd) ]
102
102
struct f32x4 ( f32 , f32 , f32 , f32 ) ;
@@ -106,7 +106,7 @@ pub struct Vector(f32x4);
106
106
107
107
// CHECK: define <4 x float> @test_Vector(<4 x float> %_1)
108
108
#[ no_mangle]
109
- pub extern fn test_Vector ( _: Vector ) -> Vector { loop { } }
109
+ pub extern "C" fn test_Vector ( _: Vector ) -> Vector { loop { } }
110
110
111
111
trait Mirror { type It : ?Sized ; }
112
112
impl < T : ?Sized > Mirror for T { type It = Self ; }
@@ -116,7 +116,7 @@ pub struct StructWithProjection(<f32 as Mirror>::It);
116
116
117
117
// CHECK: define float @test_Projection(float %_1)
118
118
#[ no_mangle]
119
- pub extern fn test_Projection ( _: StructWithProjection ) -> StructWithProjection { loop { } }
119
+ pub extern "C" fn test_Projection ( _: StructWithProjection ) -> StructWithProjection { loop { } }
120
120
121
121
#[ repr( transparent) ]
122
122
pub enum EnumF32 {
@@ -125,7 +125,7 @@ pub enum EnumF32 {
125
125
126
126
// CHECK: define float @test_EnumF32(float %_1)
127
127
#[ no_mangle]
128
- pub extern fn test_EnumF32 ( _: EnumF32 ) -> EnumF32 { loop { } }
128
+ pub extern "C" fn test_EnumF32 ( _: EnumF32 ) -> EnumF32 { loop { } }
129
129
130
130
#[ repr( transparent) ]
131
131
pub enum EnumF32WithZsts {
@@ -134,7 +134,7 @@ pub enum EnumF32WithZsts {
134
134
135
135
// CHECK: define float @test_EnumF32WithZsts(float %_1)
136
136
#[ no_mangle]
137
- pub extern fn test_EnumF32WithZsts ( _: EnumF32WithZsts ) -> EnumF32WithZsts { loop { } }
137
+ pub extern "C" fn test_EnumF32WithZsts ( _: EnumF32WithZsts ) -> EnumF32WithZsts { loop { } }
138
138
139
139
#[ repr( transparent) ]
140
140
pub union UnionF32 {
@@ -143,7 +143,7 @@ pub union UnionF32 {
143
143
144
144
// CHECK: define float @test_UnionF32(float %_1)
145
145
#[ no_mangle]
146
- pub extern fn test_UnionF32 ( _: UnionF32 ) -> UnionF32 { loop { } }
146
+ pub extern "C" fn test_UnionF32 ( _: UnionF32 ) -> UnionF32 { loop { } }
147
147
148
148
#[ repr( transparent) ]
149
149
pub union UnionF32WithZsts {
@@ -154,7 +154,7 @@ pub union UnionF32WithZsts {
154
154
155
155
// CHECK: define float @test_UnionF32WithZsts(float %_1)
156
156
#[ no_mangle]
157
- pub extern fn test_UnionF32WithZsts ( _: UnionF32WithZsts ) -> UnionF32WithZsts { loop { } }
157
+ pub extern "C" fn test_UnionF32WithZsts ( _: UnionF32WithZsts ) -> UnionF32WithZsts { loop { } }
158
158
159
159
160
160
// All that remains to be tested are aggregates. They are tested in separate files called repr-
0 commit comments