@@ -447,13 +447,13 @@ mod atomics {
447
447
use super :: * ;
448
448
449
449
macro_rules! impl_traits_for_atomics {
450
- ( $( $atomics: ident) ,* $( , ) ?) => {
450
+ ( $( $atomics: ident[ $repr : ty ] ) ,* $( , ) ?) => {
451
451
$(
452
452
impl_known_layout!( $atomics) ;
453
- impl_for_transparent_wrapper !( => TryFromBytes for $atomics) ;
454
- impl_for_transparent_wrapper !( => FromZeros for $atomics) ;
455
- impl_for_transparent_wrapper !( => FromBytes for $atomics) ;
456
- impl_for_transparent_wrapper !( => IntoBytes for $atomics) ;
453
+ impl_for_transmute_from !( => TryFromBytes for $atomics[ UnsafeCell <$repr> ] ) ;
454
+ impl_for_transmute_from !( => FromZeros for $atomics[ UnsafeCell <$repr> ] ) ;
455
+ impl_for_transmute_from !( => FromBytes for $atomics[ UnsafeCell <$repr> ] ) ;
456
+ impl_for_transmute_from !( => IntoBytes for $atomics[ UnsafeCell <$repr> ] ) ;
457
457
) *
458
458
} ;
459
459
}
@@ -465,13 +465,13 @@ mod atomics {
465
465
466
466
use super :: * ;
467
467
468
- impl_traits_for_atomics ! ( AtomicU8 , AtomicI8 ) ;
468
+ impl_traits_for_atomics ! ( AtomicU8 [ u8 ] , AtomicI8 [ i8 ] ) ;
469
469
470
470
impl_known_layout ! ( AtomicBool ) ;
471
471
472
- impl_for_transparent_wrapper ! ( => TryFromBytes for AtomicBool ) ;
473
- impl_for_transparent_wrapper ! ( => FromZeros for AtomicBool ) ;
474
- impl_for_transparent_wrapper ! ( => IntoBytes for AtomicBool ) ;
472
+ impl_for_transmute_from ! ( => TryFromBytes for AtomicBool [ UnsafeCell < bool > ] ) ;
473
+ impl_for_transmute_from ! ( => FromZeros for AtomicBool [ UnsafeCell < bool > ] ) ;
474
+ impl_for_transmute_from ! ( => IntoBytes for AtomicBool [ UnsafeCell < bool > ] ) ;
475
475
476
476
safety_comment ! {
477
477
/// SAFETY:
@@ -501,7 +501,7 @@ mod atomics {
501
501
/// SAFETY:
502
502
/// All of these pass an atomic type and that type's native equivalent, as
503
503
/// required by the macro safety preconditions.
504
- unsafe_impl_transparent_wrapper_for_atomic !( AtomicU8 [ u8 ] , AtomicI8 [ i8 ] , AtomicBool [ bool ] ) ;
504
+ unsafe_impl_transmute_from_for_atomic !( AtomicU8 [ u8 ] , AtomicI8 [ i8 ] , AtomicBool [ bool ] ) ;
505
505
}
506
506
}
507
507
@@ -512,13 +512,13 @@ mod atomics {
512
512
513
513
use super :: * ;
514
514
515
- impl_traits_for_atomics ! ( AtomicU16 , AtomicI16 ) ;
515
+ impl_traits_for_atomics ! ( AtomicU16 [ u16 ] , AtomicI16 [ i16 ] ) ;
516
516
517
517
safety_comment ! {
518
518
/// SAFETY:
519
519
/// All of these pass an atomic type and that type's native equivalent, as
520
520
/// required by the macro safety preconditions.
521
- unsafe_impl_transparent_wrapper_for_atomic !( AtomicU16 [ u16 ] , AtomicI16 [ i16 ] ) ;
521
+ unsafe_impl_transmute_from_for_atomic !( AtomicU16 [ u16 ] , AtomicI16 [ i16 ] ) ;
522
522
}
523
523
}
524
524
@@ -529,13 +529,13 @@ mod atomics {
529
529
530
530
use super :: * ;
531
531
532
- impl_traits_for_atomics ! ( AtomicU32 , AtomicI32 ) ;
532
+ impl_traits_for_atomics ! ( AtomicU32 [ u32 ] , AtomicI32 [ i32 ] ) ;
533
533
534
534
safety_comment ! {
535
535
/// SAFETY:
536
536
/// All of these pass an atomic type and that type's native equivalent, as
537
537
/// required by the macro safety preconditions.
538
- unsafe_impl_transparent_wrapper_for_atomic !( AtomicU32 [ u32 ] , AtomicI32 [ i32 ] ) ;
538
+ unsafe_impl_transmute_from_for_atomic !( AtomicU32 [ u32 ] , AtomicI32 [ i32 ] ) ;
539
539
}
540
540
}
541
541
@@ -546,13 +546,13 @@ mod atomics {
546
546
547
547
use super :: * ;
548
548
549
- impl_traits_for_atomics ! ( AtomicU64 , AtomicI64 ) ;
549
+ impl_traits_for_atomics ! ( AtomicU64 [ u64 ] , AtomicI64 [ i64 ] ) ;
550
550
551
551
safety_comment ! {
552
552
/// SAFETY:
553
553
/// All of these pass an atomic type and that type's native equivalent, as
554
554
/// required by the macro safety preconditions.
555
- unsafe_impl_transparent_wrapper_for_atomic !( AtomicU64 [ u64 ] , AtomicI64 [ i64 ] ) ;
555
+ unsafe_impl_transmute_from_for_atomic !( AtomicU64 [ u64 ] , AtomicI64 [ i64 ] ) ;
556
556
}
557
557
}
558
558
@@ -563,21 +563,21 @@ mod atomics {
563
563
564
564
use super :: * ;
565
565
566
- impl_traits_for_atomics ! ( AtomicUsize , AtomicIsize ) ;
566
+ impl_traits_for_atomics ! ( AtomicUsize [ usize ] , AtomicIsize [ isize ] ) ;
567
567
568
568
impl_known_layout ! ( T => AtomicPtr <T >) ;
569
569
570
570
// TODO(#170): Implement `FromBytes` and `IntoBytes` once we implement
571
571
// those traits for `*mut T`.
572
- impl_for_transparent_wrapper ! ( T => TryFromBytes for AtomicPtr <T >) ;
573
- impl_for_transparent_wrapper ! ( T => FromZeros for AtomicPtr <T >) ;
572
+ impl_for_transmute_from ! ( T => TryFromBytes for AtomicPtr <T >[ UnsafeCell < * mut T > ] ) ;
573
+ impl_for_transmute_from ! ( T => FromZeros for AtomicPtr <T >[ UnsafeCell < * mut T > ] ) ;
574
574
575
575
safety_comment ! {
576
576
/// SAFETY:
577
577
/// This passes an atomic type and that type's native equivalent, as
578
578
/// required by the macro safety preconditions.
579
- unsafe_impl_transparent_wrapper_for_atomic !( AtomicUsize [ usize ] , AtomicIsize [ isize ] ) ;
580
- unsafe_impl_transparent_wrapper_for_atomic !( T => AtomicPtr <T > [ * mut T ] ) ;
579
+ unsafe_impl_transmute_from_for_atomic !( AtomicUsize [ usize ] , AtomicIsize [ isize ] ) ;
580
+ unsafe_impl_transmute_from_for_atomic !( T => AtomicPtr <T > [ * mut T ] ) ;
581
581
}
582
582
}
583
583
}
@@ -607,12 +607,12 @@ safety_comment! {
607
607
assert_unaligned!( PhantomData <( ) >, PhantomData <u8 >, PhantomData <u64 >) ;
608
608
}
609
609
610
- impl_for_transparent_wrapper ! ( T : Immutable => Immutable for Wrapping <T >) ;
611
- impl_for_transparent_wrapper ! ( T : TryFromBytes => TryFromBytes for Wrapping <T >) ;
612
- impl_for_transparent_wrapper ! ( T : FromZeros => FromZeros for Wrapping <T >) ;
613
- impl_for_transparent_wrapper ! ( T : FromBytes => FromBytes for Wrapping <T >) ;
614
- impl_for_transparent_wrapper ! ( T : IntoBytes => IntoBytes for Wrapping <T >) ;
615
- impl_for_transparent_wrapper ! ( T : Unaligned => Unaligned for Wrapping <T >) ;
610
+ impl_for_transmute_from ! ( T : Immutable => Immutable for Wrapping <T >[ T ] ) ;
611
+ impl_for_transmute_from ! ( T : TryFromBytes => TryFromBytes for Wrapping <T >[ T ] ) ;
612
+ impl_for_transmute_from ! ( T : FromZeros => FromZeros for Wrapping <T >[ T ] ) ;
613
+ impl_for_transmute_from ! ( T : FromBytes => FromBytes for Wrapping <T >[ T ] ) ;
614
+ impl_for_transmute_from ! ( T : IntoBytes => IntoBytes for Wrapping <T >[ T ] ) ;
615
+ impl_for_transmute_from ! ( T : Unaligned => Unaligned for Wrapping <T >[ T ] ) ;
616
616
assert_unaligned ! ( Wrapping <( ) >, Wrapping <u8 >) ;
617
617
618
618
safety_comment ! {
@@ -624,22 +624,22 @@ safety_comment! {
624
624
unsafe_impl!( T => FromBytes for MaybeUninit <T >) ;
625
625
}
626
626
627
- impl_for_transparent_wrapper ! ( T : Immutable => Immutable for MaybeUninit <T >) ;
628
- impl_for_transparent_wrapper ! ( T : Unaligned => Unaligned for MaybeUninit <T >) ;
627
+ impl_for_transmute_from ! ( T : Immutable => Immutable for MaybeUninit <T >[ T ] ) ;
628
+ impl_for_transmute_from ! ( T : Unaligned => Unaligned for MaybeUninit <T >[ T ] ) ;
629
629
assert_unaligned ! ( MaybeUninit <( ) >, MaybeUninit <u8 >) ;
630
630
631
- impl_for_transparent_wrapper ! ( T : ?Sized + Immutable => Immutable for ManuallyDrop <T >) ;
632
- impl_for_transparent_wrapper ! ( T : ?Sized + TryFromBytes => TryFromBytes for ManuallyDrop <T >) ;
633
- impl_for_transparent_wrapper ! ( T : ?Sized + FromZeros => FromZeros for ManuallyDrop <T >) ;
634
- impl_for_transparent_wrapper ! ( T : ?Sized + FromBytes => FromBytes for ManuallyDrop <T >) ;
635
- impl_for_transparent_wrapper ! ( T : ?Sized + IntoBytes => IntoBytes for ManuallyDrop <T >) ;
636
- impl_for_transparent_wrapper ! ( T : ?Sized + Unaligned => Unaligned for ManuallyDrop <T >) ;
631
+ impl_for_transmute_from ! ( T : ?Sized + Immutable => Immutable for ManuallyDrop <T >[ T ] ) ;
632
+ impl_for_transmute_from ! ( T : ?Sized + TryFromBytes => TryFromBytes for ManuallyDrop <T >[ T ] ) ;
633
+ impl_for_transmute_from ! ( T : ?Sized + FromZeros => FromZeros for ManuallyDrop <T >[ T ] ) ;
634
+ impl_for_transmute_from ! ( T : ?Sized + FromBytes => FromBytes for ManuallyDrop <T >[ T ] ) ;
635
+ impl_for_transmute_from ! ( T : ?Sized + IntoBytes => IntoBytes for ManuallyDrop <T >[ T ] ) ;
636
+ impl_for_transmute_from ! ( T : ?Sized + Unaligned => Unaligned for ManuallyDrop <T >[ T ] ) ;
637
637
assert_unaligned ! ( ManuallyDrop <( ) >, ManuallyDrop <u8 >) ;
638
638
639
- impl_for_transparent_wrapper ! ( T : ?Sized + FromZeros => FromZeros for UnsafeCell <T >) ;
640
- impl_for_transparent_wrapper ! ( T : ?Sized + FromBytes => FromBytes for UnsafeCell <T >) ;
641
- impl_for_transparent_wrapper ! ( T : ?Sized + IntoBytes => IntoBytes for UnsafeCell <T >) ;
642
- impl_for_transparent_wrapper ! ( T : ?Sized + Unaligned => Unaligned for UnsafeCell <T >) ;
639
+ impl_for_transmute_from ! ( T : ?Sized + FromZeros => FromZeros for UnsafeCell <T >[ T ] ) ;
640
+ impl_for_transmute_from ! ( T : ?Sized + FromBytes => FromBytes for UnsafeCell <T >[ T ] ) ;
641
+ impl_for_transmute_from ! ( T : ?Sized + IntoBytes => IntoBytes for UnsafeCell <T >[ T ] ) ;
642
+ impl_for_transmute_from ! ( T : ?Sized + Unaligned => Unaligned for UnsafeCell <T >[ T ] ) ;
643
643
assert_unaligned ! ( UnsafeCell <( ) >, UnsafeCell <u8 >) ;
644
644
645
645
// SAFETY: See safety comment in `is_bit_valid` impl.
0 commit comments