@@ -443,13 +443,13 @@ mod atomics {
443
443
use super :: * ;
444
444
445
445
macro_rules! impl_traits_for_atomics {
446
- ( $( $atomics: ident) ,* $( , ) ?) => {
446
+ ( $( $atomics: ident[ $repr : ty ] ) ,* $( , ) ?) => {
447
447
$(
448
448
impl_known_layout!( $atomics) ;
449
- impl_for_transparent_wrapper !( => TryFromBytes for $atomics) ;
450
- impl_for_transparent_wrapper !( => FromZeros for $atomics) ;
451
- impl_for_transparent_wrapper !( => FromBytes for $atomics) ;
452
- impl_for_transparent_wrapper !( => IntoBytes for $atomics) ;
449
+ impl_for_transmute_from !( => TryFromBytes for $atomics[ UnsafeCell <$repr> ] ) ;
450
+ impl_for_transmute_from !( => FromZeros for $atomics[ UnsafeCell <$repr> ] ) ;
451
+ impl_for_transmute_from !( => FromBytes for $atomics[ UnsafeCell <$repr> ] ) ;
452
+ impl_for_transmute_from !( => IntoBytes for $atomics[ UnsafeCell <$repr> ] ) ;
453
453
) *
454
454
} ;
455
455
}
@@ -461,13 +461,13 @@ mod atomics {
461
461
462
462
use super :: * ;
463
463
464
- impl_traits_for_atomics ! ( AtomicU8 , AtomicI8 ) ;
464
+ impl_traits_for_atomics ! ( AtomicU8 [ u8 ] , AtomicI8 [ i8 ] ) ;
465
465
466
466
impl_known_layout ! ( AtomicBool ) ;
467
467
468
- impl_for_transparent_wrapper ! ( => TryFromBytes for AtomicBool ) ;
469
- impl_for_transparent_wrapper ! ( => FromZeros for AtomicBool ) ;
470
- impl_for_transparent_wrapper ! ( => IntoBytes for AtomicBool ) ;
468
+ impl_for_transmute_from ! ( => TryFromBytes for AtomicBool [ UnsafeCell < bool > ] ) ;
469
+ impl_for_transmute_from ! ( => FromZeros for AtomicBool [ UnsafeCell < bool > ] ) ;
470
+ impl_for_transmute_from ! ( => IntoBytes for AtomicBool [ UnsafeCell < bool > ] ) ;
471
471
472
472
safety_comment ! {
473
473
/// SAFETY:
@@ -497,7 +497,7 @@ mod atomics {
497
497
/// SAFETY:
498
498
/// All of these pass an atomic type and that type's native equivalent, as
499
499
/// required by the macro safety preconditions.
500
- unsafe_impl_transparent_wrapper_for_atomic !( AtomicU8 [ u8 ] , AtomicI8 [ i8 ] , AtomicBool [ bool ] ) ;
500
+ unsafe_impl_transmute_from_for_atomic !( AtomicU8 [ u8 ] , AtomicI8 [ i8 ] , AtomicBool [ bool ] ) ;
501
501
}
502
502
}
503
503
@@ -508,13 +508,13 @@ mod atomics {
508
508
509
509
use super :: * ;
510
510
511
- impl_traits_for_atomics ! ( AtomicU16 , AtomicI16 ) ;
511
+ impl_traits_for_atomics ! ( AtomicU16 [ u16 ] , AtomicI16 [ i16 ] ) ;
512
512
513
513
safety_comment ! {
514
514
/// SAFETY:
515
515
/// All of these pass an atomic type and that type's native equivalent, as
516
516
/// required by the macro safety preconditions.
517
- unsafe_impl_transparent_wrapper_for_atomic !( AtomicU16 [ u16 ] , AtomicI16 [ i16 ] ) ;
517
+ unsafe_impl_transmute_from_for_atomic !( AtomicU16 [ u16 ] , AtomicI16 [ i16 ] ) ;
518
518
}
519
519
}
520
520
@@ -525,13 +525,13 @@ mod atomics {
525
525
526
526
use super :: * ;
527
527
528
- impl_traits_for_atomics ! ( AtomicU32 , AtomicI32 ) ;
528
+ impl_traits_for_atomics ! ( AtomicU32 [ u32 ] , AtomicI32 [ i32 ] ) ;
529
529
530
530
safety_comment ! {
531
531
/// SAFETY:
532
532
/// All of these pass an atomic type and that type's native equivalent, as
533
533
/// required by the macro safety preconditions.
534
- unsafe_impl_transparent_wrapper_for_atomic !( AtomicU32 [ u32 ] , AtomicI32 [ i32 ] ) ;
534
+ unsafe_impl_transmute_from_for_atomic !( AtomicU32 [ u32 ] , AtomicI32 [ i32 ] ) ;
535
535
}
536
536
}
537
537
@@ -542,13 +542,13 @@ mod atomics {
542
542
543
543
use super :: * ;
544
544
545
- impl_traits_for_atomics ! ( AtomicU64 , AtomicI64 ) ;
545
+ impl_traits_for_atomics ! ( AtomicU64 [ u64 ] , AtomicI64 [ i64 ] ) ;
546
546
547
547
safety_comment ! {
548
548
/// SAFETY:
549
549
/// All of these pass an atomic type and that type's native equivalent, as
550
550
/// required by the macro safety preconditions.
551
- unsafe_impl_transparent_wrapper_for_atomic !( AtomicU64 [ u64 ] , AtomicI64 [ i64 ] ) ;
551
+ unsafe_impl_transmute_from_for_atomic !( AtomicU64 [ u64 ] , AtomicI64 [ i64 ] ) ;
552
552
}
553
553
}
554
554
@@ -559,21 +559,21 @@ mod atomics {
559
559
560
560
use super :: * ;
561
561
562
- impl_traits_for_atomics ! ( AtomicUsize , AtomicIsize ) ;
562
+ impl_traits_for_atomics ! ( AtomicUsize [ usize ] , AtomicIsize [ isize ] ) ;
563
563
564
564
impl_known_layout ! ( T => AtomicPtr <T >) ;
565
565
566
566
// TODO(#170): Implement `FromBytes` and `IntoBytes` once we implement
567
567
// those traits for `*mut T`.
568
- impl_for_transparent_wrapper ! ( T => TryFromBytes for AtomicPtr <T >) ;
569
- impl_for_transparent_wrapper ! ( T => FromZeros for AtomicPtr <T >) ;
568
+ impl_for_transmute_from ! ( T => TryFromBytes for AtomicPtr <T >[ UnsafeCell < * mut T > ] ) ;
569
+ impl_for_transmute_from ! ( T => FromZeros for AtomicPtr <T >[ UnsafeCell < * mut T > ] ) ;
570
570
571
571
safety_comment ! {
572
572
/// SAFETY:
573
573
/// This passes an atomic type and that type's native equivalent, as
574
574
/// required by the macro safety preconditions.
575
- unsafe_impl_transparent_wrapper_for_atomic !( AtomicUsize [ usize ] , AtomicIsize [ isize ] ) ;
576
- unsafe_impl_transparent_wrapper_for_atomic !( T => AtomicPtr <T > [ * mut T ] ) ;
575
+ unsafe_impl_transmute_from_for_atomic !( AtomicUsize [ usize ] , AtomicIsize [ isize ] ) ;
576
+ unsafe_impl_transmute_from_for_atomic !( T => AtomicPtr <T > [ * mut T ] ) ;
577
577
}
578
578
}
579
579
}
@@ -603,12 +603,12 @@ safety_comment! {
603
603
assert_unaligned!( PhantomData <( ) >, PhantomData <u8 >, PhantomData <u64 >) ;
604
604
}
605
605
606
- impl_for_transparent_wrapper ! ( T : Immutable => Immutable for Wrapping <T >) ;
607
- impl_for_transparent_wrapper ! ( T : TryFromBytes => TryFromBytes for Wrapping <T >) ;
608
- impl_for_transparent_wrapper ! ( T : FromZeros => FromZeros for Wrapping <T >) ;
609
- impl_for_transparent_wrapper ! ( T : FromBytes => FromBytes for Wrapping <T >) ;
610
- impl_for_transparent_wrapper ! ( T : IntoBytes => IntoBytes for Wrapping <T >) ;
611
- impl_for_transparent_wrapper ! ( T : Unaligned => Unaligned for Wrapping <T >) ;
606
+ impl_for_transmute_from ! ( T : Immutable => Immutable for Wrapping <T >[ T ] ) ;
607
+ impl_for_transmute_from ! ( T : TryFromBytes => TryFromBytes for Wrapping <T >[ T ] ) ;
608
+ impl_for_transmute_from ! ( T : FromZeros => FromZeros for Wrapping <T >[ T ] ) ;
609
+ impl_for_transmute_from ! ( T : FromBytes => FromBytes for Wrapping <T >[ T ] ) ;
610
+ impl_for_transmute_from ! ( T : IntoBytes => IntoBytes for Wrapping <T >[ T ] ) ;
611
+ impl_for_transmute_from ! ( T : Unaligned => Unaligned for Wrapping <T >[ T ] ) ;
612
612
assert_unaligned ! ( Wrapping <( ) >, Wrapping <u8 >) ;
613
613
614
614
safety_comment ! {
@@ -620,22 +620,22 @@ safety_comment! {
620
620
unsafe_impl!( T => FromBytes for MaybeUninit <T >) ;
621
621
}
622
622
623
- impl_for_transparent_wrapper ! ( T : Immutable => Immutable for MaybeUninit <T >) ;
624
- impl_for_transparent_wrapper ! ( T : Unaligned => Unaligned for MaybeUninit <T >) ;
623
+ impl_for_transmute_from ! ( T : Immutable => Immutable for MaybeUninit <T >[ T ] ) ;
624
+ impl_for_transmute_from ! ( T : Unaligned => Unaligned for MaybeUninit <T >[ T ] ) ;
625
625
assert_unaligned ! ( MaybeUninit <( ) >, MaybeUninit <u8 >) ;
626
626
627
- impl_for_transparent_wrapper ! ( T : ?Sized + Immutable => Immutable for ManuallyDrop <T >) ;
628
- impl_for_transparent_wrapper ! ( T : ?Sized + TryFromBytes => TryFromBytes for ManuallyDrop <T >) ;
629
- impl_for_transparent_wrapper ! ( T : ?Sized + FromZeros => FromZeros for ManuallyDrop <T >) ;
630
- impl_for_transparent_wrapper ! ( T : ?Sized + FromBytes => FromBytes for ManuallyDrop <T >) ;
631
- impl_for_transparent_wrapper ! ( T : ?Sized + IntoBytes => IntoBytes for ManuallyDrop <T >) ;
632
- impl_for_transparent_wrapper ! ( T : ?Sized + Unaligned => Unaligned for ManuallyDrop <T >) ;
627
+ impl_for_transmute_from ! ( T : ?Sized + Immutable => Immutable for ManuallyDrop <T >[ T ] ) ;
628
+ impl_for_transmute_from ! ( T : ?Sized + TryFromBytes => TryFromBytes for ManuallyDrop <T >[ T ] ) ;
629
+ impl_for_transmute_from ! ( T : ?Sized + FromZeros => FromZeros for ManuallyDrop <T >[ T ] ) ;
630
+ impl_for_transmute_from ! ( T : ?Sized + FromBytes => FromBytes for ManuallyDrop <T >[ T ] ) ;
631
+ impl_for_transmute_from ! ( T : ?Sized + IntoBytes => IntoBytes for ManuallyDrop <T >[ T ] ) ;
632
+ impl_for_transmute_from ! ( T : ?Sized + Unaligned => Unaligned for ManuallyDrop <T >[ T ] ) ;
633
633
assert_unaligned ! ( ManuallyDrop <( ) >, ManuallyDrop <u8 >) ;
634
634
635
- impl_for_transparent_wrapper ! ( T : ?Sized + FromZeros => FromZeros for UnsafeCell <T >) ;
636
- impl_for_transparent_wrapper ! ( T : ?Sized + FromBytes => FromBytes for UnsafeCell <T >) ;
637
- impl_for_transparent_wrapper ! ( T : ?Sized + IntoBytes => IntoBytes for UnsafeCell <T >) ;
638
- impl_for_transparent_wrapper ! ( T : ?Sized + Unaligned => Unaligned for UnsafeCell <T >) ;
635
+ impl_for_transmute_from ! ( T : ?Sized + FromZeros => FromZeros for UnsafeCell <T >[ T ] ) ;
636
+ impl_for_transmute_from ! ( T : ?Sized + FromBytes => FromBytes for UnsafeCell <T >[ T ] ) ;
637
+ impl_for_transmute_from ! ( T : ?Sized + IntoBytes => IntoBytes for UnsafeCell <T >[ T ] ) ;
638
+ impl_for_transmute_from ! ( T : ?Sized + Unaligned => Unaligned for UnsafeCell <T >[ T ] ) ;
639
639
assert_unaligned ! ( UnsafeCell <( ) >, UnsafeCell <u8 >) ;
640
640
641
641
// SAFETY: See safety comment in `is_bit_valid` impl.
0 commit comments