@@ -2346,17 +2346,12 @@ assert_eq!(
23462346 #[ rustc_const_stable( feature = "const_int_conversion" , since = "1.44.0" ) ]
23472347 // SAFETY: const sound because integers are plain old datatypes so we can always
23482348 // transmute them to arrays of bytes
2349- #[ allow_internal_unstable( const_fn_union ) ]
2349+ #[ allow_internal_unstable( const_fn_transmute ) ]
23502350 #[ inline]
23512351 pub const fn to_ne_bytes( self ) -> [ u8 ; mem:: size_of:: <Self >( ) ] {
2352- #[ repr( C ) ]
2353- union Bytes {
2354- val: $SelfT,
2355- bytes: [ u8 ; mem:: size_of:: <$SelfT>( ) ] ,
2356- }
23572352 // SAFETY: integers are plain old datatypes so we can always transmute them to
23582353 // arrays of bytes
2359- unsafe { Bytes { val : self } . bytes }
2354+ unsafe { mem :: transmute ( self ) }
23602355 }
23612356 }
23622357
@@ -2464,16 +2459,11 @@ fn read_ne_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT),
24642459 #[ rustc_const_stable( feature = "const_int_conversion" , since = "1.44.0" ) ]
24652460 // SAFETY: const sound because integers are plain old datatypes so we can always
24662461 // transmute to them
2467- #[ allow_internal_unstable( const_fn_union ) ]
2462+ #[ allow_internal_unstable( const_fn_transmute ) ]
24682463 #[ inline]
24692464 pub const fn from_ne_bytes( bytes: [ u8 ; mem:: size_of:: <Self >( ) ] ) -> Self {
2470- #[ repr( C ) ]
2471- union Bytes {
2472- val: $SelfT,
2473- bytes: [ u8 ; mem:: size_of:: <$SelfT>( ) ] ,
2474- }
24752465 // SAFETY: integers are plain old datatypes so we can always transmute to them
2476- unsafe { Bytes { bytes } . val }
2466+ unsafe { mem :: transmute ( bytes) }
24772467 }
24782468 }
24792469
@@ -4368,17 +4358,12 @@ assert_eq!(
43684358 #[ rustc_const_stable( feature = "const_int_conversion" , since = "1.44.0" ) ]
43694359 // SAFETY: const sound because integers are plain old datatypes so we can always
43704360 // transmute them to arrays of bytes
4371- #[ allow_internal_unstable( const_fn_union ) ]
4361+ #[ allow_internal_unstable( const_fn_transmute ) ]
43724362 #[ inline]
43734363 pub const fn to_ne_bytes( self ) -> [ u8 ; mem:: size_of:: <Self >( ) ] {
4374- #[ repr( C ) ]
4375- union Bytes {
4376- val: $SelfT,
4377- bytes: [ u8 ; mem:: size_of:: <$SelfT>( ) ] ,
4378- }
43794364 // SAFETY: integers are plain old datatypes so we can always transmute them to
43804365 // arrays of bytes
4381- unsafe { Bytes { val : self } . bytes }
4366+ unsafe { mem :: transmute ( self ) }
43824367 }
43834368 }
43844369
@@ -4486,16 +4471,11 @@ fn read_ne_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT),
44864471 #[ rustc_const_stable( feature = "const_int_conversion" , since = "1.44.0" ) ]
44874472 // SAFETY: const sound because integers are plain old datatypes so we can always
44884473 // transmute to them
4489- #[ allow_internal_unstable( const_fn_union ) ]
4474+ #[ allow_internal_unstable( const_fn_transmute ) ]
44904475 #[ inline]
44914476 pub const fn from_ne_bytes( bytes: [ u8 ; mem:: size_of:: <Self >( ) ] ) -> Self {
4492- #[ repr( C ) ]
4493- union Bytes {
4494- val: $SelfT,
4495- bytes: [ u8 ; mem:: size_of:: <$SelfT>( ) ] ,
4496- }
44974477 // SAFETY: integers are plain old datatypes so we can always transmute to them
4498- unsafe { Bytes { bytes } . val }
4478+ unsafe { mem :: transmute ( bytes) }
44994479 }
45004480 }
45014481
0 commit comments