@@ -189,7 +189,7 @@ mod prelude {
189
189
#[ cfg( not( host) ) ]
190
190
use prelude:: * ;
191
191
192
- macro_rules! assert_abi_compatible {
192
+ macro_rules! test_abi_compatible {
193
193
( $name: ident, $t1: ty, $t2: ty) => {
194
194
mod $name {
195
195
use super :: * ;
@@ -212,16 +212,6 @@ impl Clone for Zst {
212
212
}
213
213
}
214
214
215
- #[ repr( C ) ]
216
- struct ReprC1 < T : ?Sized > ( T ) ;
217
- #[ repr( C ) ]
218
- struct ReprC2Int < T > ( i32 , T ) ;
219
- #[ repr( C ) ]
220
- struct ReprC2Float < T > ( f32 , T ) ;
221
- #[ repr( C ) ]
222
- struct ReprC4 < T > ( T , Vec < i32 > , Zst , T ) ;
223
- #[ repr( C ) ]
224
- struct ReprC4Mixed < T > ( T , f32 , i32 , T ) ;
225
215
#[ repr( C ) ]
226
216
enum ReprCEnum < T > {
227
217
Variant1 ,
@@ -233,23 +223,6 @@ union ReprCUnion<T> {
233
223
something : ManuallyDrop < T > ,
234
224
}
235
225
236
- macro_rules! test_abi_compatible {
237
- ( $name: ident, $t1: ty, $t2: ty) => {
238
- mod $name {
239
- use super :: * ;
240
- assert_abi_compatible!( plain, $t1, $t2) ;
241
- // We also do some tests with differences in fields of `repr(C)` types.
242
- assert_abi_compatible!( repr_c_1, ReprC1 <$t1>, ReprC1 <$t2>) ;
243
- assert_abi_compatible!( repr_c_2_int, ReprC2Int <$t1>, ReprC2Int <$t2>) ;
244
- assert_abi_compatible!( repr_c_2_float, ReprC2Float <$t1>, ReprC2Float <$t2>) ;
245
- assert_abi_compatible!( repr_c_4, ReprC4 <$t1>, ReprC4 <$t2>) ;
246
- assert_abi_compatible!( repr_c_4mixed, ReprC4Mixed <$t1>, ReprC4Mixed <$t2>) ;
247
- assert_abi_compatible!( repr_c_enum, ReprCEnum <$t1>, ReprCEnum <$t2>) ;
248
- assert_abi_compatible!( repr_c_union, ReprCUnion <$t1>, ReprCUnion <$t2>) ;
249
- }
250
- } ;
251
- }
252
-
253
226
// Compatibility of pointers.
254
227
test_abi_compatible ! ( ptr_mut, * const i32 , * mut i32 ) ;
255
228
test_abi_compatible ! ( ptr_pointee, * const i32 , * const Vec <i32 >) ;
@@ -268,7 +241,6 @@ test_abi_compatible!(isize_int, isize, i64);
268
241
269
242
// Compatibility of 1-ZST.
270
243
test_abi_compatible ! ( zst_unit, Zst , ( ) ) ;
271
- #[ cfg( not( any( target_arch = "sparc64" ) ) ) ]
272
244
test_abi_compatible ! ( zst_array, Zst , [ u8 ; 0 ] ) ;
273
245
test_abi_compatible ! ( nonzero_int, NonZero <i32 >, i32 ) ;
274
246
@@ -285,13 +257,13 @@ test_abi_compatible!(arc, Arc<i32>, *mut i32);
285
257
286
258
// `repr(transparent)` compatibility.
287
259
#[ repr( transparent) ]
288
- struct Wrapper1 < T : ?Sized > ( T ) ;
260
+ struct TransparentWrapper1 < T : ?Sized > ( T ) ;
289
261
#[ repr( transparent) ]
290
- struct Wrapper2 < T : ?Sized > ( ( ) , Zst , T ) ;
262
+ struct TransparentWrapper2 < T : ?Sized > ( ( ) , Zst , T ) ;
291
263
#[ repr( transparent) ]
292
- struct Wrapper3 < T > ( T , [ u8 ; 0 ] , PhantomData < u64 > ) ;
264
+ struct TransparentWrapper3 < T > ( T , [ u8 ; 0 ] , PhantomData < u64 > ) ;
293
265
#[ repr( transparent) ]
294
- union WrapperUnion < T > {
266
+ union TransparentWrapperUnion < T > {
295
267
nothing : ( ) ,
296
268
something : ManuallyDrop < T > ,
297
269
}
@@ -300,10 +272,10 @@ macro_rules! test_transparent {
300
272
( $name: ident, $t: ty) => {
301
273
mod $name {
302
274
use super :: * ;
303
- test_abi_compatible!( wrap1, $t, Wrapper1 <$t>) ;
304
- test_abi_compatible!( wrap2, $t, Wrapper2 <$t>) ;
305
- test_abi_compatible!( wrap3, $t, Wrapper3 <$t>) ;
306
- test_abi_compatible!( wrap4, $t, WrapperUnion <$t>) ;
275
+ test_abi_compatible!( wrap1, $t, TransparentWrapper1 <$t>) ;
276
+ test_abi_compatible!( wrap2, $t, TransparentWrapper2 <$t>) ;
277
+ test_abi_compatible!( wrap3, $t, TransparentWrapper3 <$t>) ;
278
+ test_abi_compatible!( wrap4, $t, TransparentWrapperUnion <$t>) ;
307
279
}
308
280
} ;
309
281
}
@@ -342,10 +314,8 @@ macro_rules! test_transparent_unsized {
342
314
( $name: ident, $t: ty) => {
343
315
mod $name {
344
316
use super :: * ;
345
- assert_abi_compatible!( wrap1, $t, Wrapper1 <$t>) ;
346
- assert_abi_compatible!( wrap1_reprc, ReprC1 <$t>, ReprC1 <Wrapper1 <$t>>) ;
347
- assert_abi_compatible!( wrap2, $t, Wrapper2 <$t>) ;
348
- assert_abi_compatible!( wrap2_reprc, ReprC1 <$t>, ReprC1 <Wrapper2 <$t>>) ;
317
+ test_abi_compatible!( wrap1, $t, TransparentWrapper1 <$t>) ;
318
+ test_abi_compatible!( wrap2, $t, TransparentWrapper2 <$t>) ;
349
319
}
350
320
} ;
351
321
}
0 commit comments