@@ -37,15 +37,6 @@ mod flt2dec;
37
37
mod dec2flt;
38
38
mod bignum;
39
39
40
-
41
- /// Adds the attribute to all items in the block.
42
- macro_rules! cfg_block {
43
- ( $( #[ $attr: meta] { $( $it: item) * } ) * ) => { $( $(
44
- #[ $attr]
45
- $it
46
- ) * ) * }
47
- }
48
-
49
40
/// Groups items that assume the pointer width is either 16/32/64, and has to be altered if
50
41
/// support for larger/smaller pointer widths are added in the future.
51
42
macro_rules! assume_usize_width {
@@ -318,42 +309,6 @@ assume_usize_width! {
318
309
319
310
test_impl_try_from_always_ok! { test_try_u16usize, u16 , usize }
320
311
test_impl_try_from_always_ok! { test_try_i16isize, i16 , isize }
321
-
322
- test_impl_try_from_always_ok! { test_try_usizeu64, usize , u64 }
323
- test_impl_try_from_always_ok! { test_try_usizeu128, usize , u128 }
324
- test_impl_try_from_always_ok! { test_try_usizei128, usize , i128 }
325
-
326
- test_impl_try_from_always_ok! { test_try_isizei64, isize , i64 }
327
- test_impl_try_from_always_ok! { test_try_isizei128, isize , i128 }
328
-
329
- cfg_block!(
330
- #[ cfg( target_pointer_width = "16" ) ] {
331
- test_impl_try_from_always_ok! { test_try_usizeu16, usize , u16 }
332
- test_impl_try_from_always_ok! { test_try_isizei16, isize , i16 }
333
- test_impl_try_from_always_ok! { test_try_usizeu32, usize , u32 }
334
- test_impl_try_from_always_ok! { test_try_usizei32, usize , i32 }
335
- test_impl_try_from_always_ok! { test_try_isizei32, isize , i32 }
336
- test_impl_try_from_always_ok! { test_try_usizei64, usize , i64 }
337
- }
338
-
339
- #[ cfg( target_pointer_width = "32" ) ] {
340
- test_impl_try_from_always_ok! { test_try_u16isize, u16 , isize }
341
- test_impl_try_from_always_ok! { test_try_usizeu32, usize , u32 }
342
- test_impl_try_from_always_ok! { test_try_isizei32, isize , i32 }
343
- test_impl_try_from_always_ok! { test_try_u32usize, u32 , usize }
344
- test_impl_try_from_always_ok! { test_try_i32isize, i32 , isize }
345
- test_impl_try_from_always_ok! { test_try_usizei64, usize , i64 }
346
- }
347
-
348
- #[ cfg( target_pointer_width = "64" ) ] {
349
- test_impl_try_from_always_ok! { test_try_u16isize, u16 , isize }
350
- test_impl_try_from_always_ok! { test_try_u32usize, u32 , usize }
351
- test_impl_try_from_always_ok! { test_try_u32isize, u32 , isize }
352
- test_impl_try_from_always_ok! { test_try_i32isize, i32 , isize }
353
- test_impl_try_from_always_ok! { test_try_u64usize, u64 , usize }
354
- test_impl_try_from_always_ok! { test_try_i64isize, i64 , isize }
355
- }
356
- ) ;
357
312
}
358
313
359
314
/// Conversions where max of $source can be represented as $target,
@@ -402,24 +357,6 @@ assume_usize_width! {
402
357
test_impl_try_from_signed_to_unsigned_upper_ok! { test_try_isizeu64, isize , u64 }
403
358
test_impl_try_from_signed_to_unsigned_upper_ok! { test_try_isizeu128, isize , u128 }
404
359
test_impl_try_from_signed_to_unsigned_upper_ok! { test_try_isizeusize, isize , usize }
405
-
406
- cfg_block!(
407
- #[ cfg( target_pointer_width = "16" ) ] {
408
- test_impl_try_from_signed_to_unsigned_upper_ok! { test_try_isizeu16, isize , u16 }
409
- test_impl_try_from_signed_to_unsigned_upper_ok! { test_try_isizeu32, isize , u32 }
410
- }
411
-
412
- #[ cfg( target_pointer_width = "32" ) ] {
413
- test_impl_try_from_signed_to_unsigned_upper_ok! { test_try_isizeu32, isize , u32 }
414
-
415
- test_impl_try_from_signed_to_unsigned_upper_ok! { test_try_i32usize, i32 , usize }
416
- }
417
-
418
- #[ cfg( target_pointer_width = "64" ) ] {
419
- test_impl_try_from_signed_to_unsigned_upper_ok! { test_try_i32usize, i32 , usize }
420
- test_impl_try_from_signed_to_unsigned_upper_ok! { test_try_i64usize, i64 , usize }
421
- }
422
- ) ;
423
360
}
424
361
425
362
/// Conversions where max of $source can not be represented as $target,
@@ -461,29 +398,9 @@ test_impl_try_from_unsigned_to_signed_upper_err! { test_try_u128i64, u128, i64 }
461
398
test_impl_try_from_unsigned_to_signed_upper_err ! { test_try_u128i128, u128 , i128 }
462
399
463
400
assume_usize_width ! {
464
- test_impl_try_from_unsigned_to_signed_upper_err! { test_try_u64isize, u64 , isize }
465
- test_impl_try_from_unsigned_to_signed_upper_err! { test_try_u128isize, u128 , isize }
466
-
467
401
test_impl_try_from_unsigned_to_signed_upper_err! { test_try_usizei8, usize , i8 }
468
402
test_impl_try_from_unsigned_to_signed_upper_err! { test_try_usizei16, usize , i16 }
469
403
test_impl_try_from_unsigned_to_signed_upper_err! { test_try_usizeisize, usize , isize }
470
-
471
- cfg_block!(
472
- #[ cfg( target_pointer_width = "16" ) ] {
473
- test_impl_try_from_unsigned_to_signed_upper_err! { test_try_u16isize, u16 , isize }
474
- test_impl_try_from_unsigned_to_signed_upper_err! { test_try_u32isize, u32 , isize }
475
- }
476
-
477
- #[ cfg( target_pointer_width = "32" ) ] {
478
- test_impl_try_from_unsigned_to_signed_upper_err! { test_try_u32isize, u32 , isize }
479
- test_impl_try_from_unsigned_to_signed_upper_err! { test_try_usizei32, usize , i32 }
480
- }
481
-
482
- #[ cfg( target_pointer_width = "64" ) ] {
483
- test_impl_try_from_unsigned_to_signed_upper_err! { test_try_usizei32, usize , i32 }
484
- test_impl_try_from_unsigned_to_signed_upper_err! { test_try_usizei64, usize , i64 }
485
- }
486
- ) ;
487
404
}
488
405
489
406
/// Conversions where min/max of $source can not be represented as $target.
@@ -543,34 +460,6 @@ test_impl_try_from_same_sign_err! { test_try_i128i64, i128, i64 }
543
460
544
461
assume_usize_width ! {
545
462
test_impl_try_from_same_sign_err! { test_try_usizeu8, usize , u8 }
546
- test_impl_try_from_same_sign_err! { test_try_u128usize, u128 , usize }
547
- test_impl_try_from_same_sign_err! { test_try_i128isize, i128 , isize }
548
-
549
- cfg_block!(
550
- #[ cfg( target_pointer_width = "16" ) ] {
551
- test_impl_try_from_same_sign_err! { test_try_u32usize, u32 , usize }
552
- test_impl_try_from_same_sign_err! { test_try_u64usize, u64 , usize }
553
-
554
- test_impl_try_from_same_sign_err! { test_try_i32isize, i32 , isize }
555
- test_impl_try_from_same_sign_err! { test_try_i64isize, i64 , isize }
556
- }
557
-
558
- #[ cfg( target_pointer_width = "32" ) ] {
559
- test_impl_try_from_same_sign_err! { test_try_u64usize, u64 , usize }
560
- test_impl_try_from_same_sign_err! { test_try_usizeu16, usize , u16 }
561
-
562
- test_impl_try_from_same_sign_err! { test_try_i64isize, i64 , isize }
563
- test_impl_try_from_same_sign_err! { test_try_isizei16, isize , i16 }
564
- }
565
-
566
- #[ cfg( target_pointer_width = "64" ) ] {
567
- test_impl_try_from_same_sign_err! { test_try_usizeu16, usize , u16 }
568
- test_impl_try_from_same_sign_err! { test_try_usizeu32, usize , u32 }
569
-
570
- test_impl_try_from_same_sign_err! { test_try_isizei16, isize , i16 }
571
- test_impl_try_from_same_sign_err! { test_try_isizei32, isize , i32 }
572
- }
573
- ) ;
574
463
}
575
464
576
465
/// Conversions where neither the min nor the max of $source can be represented by
@@ -615,22 +504,6 @@ test_impl_try_from_signed_to_unsigned_err! { test_try_i128u64, i128, u64 }
615
504
assume_usize_width ! {
616
505
test_impl_try_from_signed_to_unsigned_err! { test_try_isizeu8, isize , u8 }
617
506
test_impl_try_from_signed_to_unsigned_err! { test_try_i128usize, i128 , usize }
618
-
619
- cfg_block! {
620
- #[ cfg( target_pointer_width = "16" ) ] {
621
- test_impl_try_from_signed_to_unsigned_err! { test_try_i32usize, i32 , usize }
622
- test_impl_try_from_signed_to_unsigned_err! { test_try_i64usize, i64 , usize }
623
- }
624
- #[ cfg( target_pointer_width = "32" ) ] {
625
- test_impl_try_from_signed_to_unsigned_err! { test_try_i64usize, i64 , usize }
626
-
627
- test_impl_try_from_signed_to_unsigned_err! { test_try_isizeu16, isize , u16 }
628
- }
629
- #[ cfg( target_pointer_width = "64" ) ] {
630
- test_impl_try_from_signed_to_unsigned_err! { test_try_isizeu16, isize , u16 }
631
- test_impl_try_from_signed_to_unsigned_err! { test_try_isizeu32, isize , u32 }
632
- }
633
- }
634
507
}
635
508
636
509
macro_rules! test_float {
0 commit comments