@@ -105,12 +105,13 @@ assert_unaligned!(bool);
105105//   pattern 0x01. 
106106const  _:  ( )  = unsafe  { 
107107    unsafe_impl ! ( => TryFromBytes  for  bool ;  |byte| { 
108-         let  byte = byte. transmute:: <u8 ,  invariant:: Valid ,  _>( ) ; 
108+         let  mut  byte = byte; 
109+         let  byte = byte. reborrow( ) . into_shared( ) . transmute:: <u8 ,  invariant:: Valid ,  _>( ) ; 
109110        * byte. unaligned_as_ref( )  < 2 
110111    } ) 
111112} ; 
112113
113- impl_size_compat ! ( bool ,  u8 ) ; 
114+ impl_size_from ! ( bool ,  u8 ) ; 
114115
115116// SAFETY: 
116117// - `Immutable`: `char` self-evidently does not contain any `UnsafeCell`s. 
@@ -135,13 +136,14 @@ const _: () = unsafe { unsafe_impl!(char: Immutable, FromZeros, IntoBytes) };
135136//   `char`. 
136137const  _:  ( )  = unsafe  { 
137138    unsafe_impl ! ( => TryFromBytes  for  char ;  |c| { 
138-         let  c = c. transmute:: <Unalign <u32 >,  invariant:: Valid ,  _>( ) ; 
139+         let  mut  c = c; 
140+         let  c = c. reborrow( ) . into_shared( ) . transmute:: <Unalign <u32 >,  invariant:: Valid ,  _>( ) ; 
139141        let  c = c. read_unaligned( ) . into_inner( ) ; 
140142        char :: from_u32( c) . is_some( ) 
141143    } ) ; 
142144} ; 
143145
144- impl_size_compat ! ( char ,  Unalign <u32 >) ; 
146+ impl_size_from ! ( char ,  Unalign <u32 >) ; 
145147
146148// SAFETY: Per the Reference [1], `str` has the same layout as `[u8]`. 
147149// - `Immutable`: `[u8]` does not contain any `UnsafeCell`s. 
@@ -168,20 +170,22 @@ const _: () = unsafe { unsafe_impl!(str: Immutable, FromZeros, IntoBytes, Unalig
168170//   Returns `Err` if the slice is not UTF-8. 
169171const  _:  ( )  = unsafe  { 
170172    unsafe_impl ! ( => TryFromBytes  for  str ;  |c| { 
171-         let  c = c. transmute:: <[ u8 ] ,  invariant:: Valid ,  _>( ) ; 
173+         let  mut  c = c; 
174+         let  c = c. reborrow( ) . into_shared( ) . transmute:: <[ u8 ] ,  invariant:: Valid ,  _>( ) ; 
172175        let  c = c. unaligned_as_ref( ) ; 
173176        core:: str :: from_utf8( c) . is_ok( ) 
174177    } ) 
175178} ; 
176179
177- impl_size_compat ! ( str ,  [ u8 ] ) ; 
180+ impl_size_from ! ( str ,  [ u8 ] ) ; 
178181
179182macro_rules!  unsafe_impl_try_from_bytes_for_nonzero { 
180183    ( $( $nonzero: ident[ $prim: ty] ) ,* )  => { 
181184        $( 
182185            unsafe_impl!( => TryFromBytes  for  $nonzero;  |n| { 
183-                 impl_size_compat!( $nonzero,  Unalign <$prim>) ; 
184-                 let  n = n. transmute:: <Unalign <$prim>,  invariant:: Valid ,  _>( ) ; 
186+                 impl_size_from!( $nonzero,  Unalign <$prim>) ; 
187+                 let  mut  n = n; 
188+                 let  n = n. reborrow( ) . into_shared( ) . transmute:: <Unalign <$prim>,  invariant:: Valid ,  _>( ) ; 
185189                $nonzero:: new( n. read_unaligned( ) . into_inner( ) ) . is_some( ) 
186190            } ) ; 
187191        ) * 
@@ -397,22 +401,22 @@ mod atomics {
397401            crate :: util:: macros:: __unsafe( ) ; 
398402
399403            use  core:: { cell:: UnsafeCell } ; 
400-             use  crate :: pointer:: { TransmuteFrom ,  PtrInner ,  SizeCompat ,  invariant:: Valid } ; 
404+             use  crate :: pointer:: { TransmuteFrom ,  PtrInner ,  SizeFrom ,  invariant:: Valid } ; 
401405
402406            $( 
403-                 // SAFETY: The caller promised that `$atomic` and `$prim` 
404-                 // have  the same size and bit validity. As a result of size 
405-                 // equality,  both impls of `SizeCompat ::cast_from_raw` 
406-                 // preserve referent  size exactly. 
407+                 // SAFETY: The caller promised that `$atomic` and `$prim` have  
408+                 // the same size and bit validity. As a result of size equality,  
409+                 // both impls of `SizeFrom ::cast_from_raw` preserve referent  
410+                 // size exactly. 
407411                unsafe  impl <$( $tyvar) ?> TransmuteFrom <$atomic,  Valid ,  Valid > for  $prim { } 
408-                 // SAFETY: The caller promised that `$atomic` and `$prim` 
409-                 // have  the same size and bit validity. As a result of size 
410-                 // equality,  both impls of `SizeCompat ::cast_from_raw` 
411-                 // preserve referent  size exactly. 
412+                 // SAFETY: The caller promised that `$atomic` and `$prim` have  
413+                 // the same size and bit validity. As a result of size equality,  
414+                 // both impls of `SizeFrom ::cast_from_raw` preserve referent  
415+                 // size exactly. 
412416                unsafe  impl <$( $tyvar) ?> TransmuteFrom <$prim,  Valid ,  Valid > for  $atomic { } 
413417
414418                // SAFETY: See inline safety comment. 
415-                 unsafe  impl <$( $tyvar) ?> SizeCompat <$atomic> for  $prim { 
419+                 unsafe  impl <$( $tyvar) ?> SizeFrom <$atomic> for  $prim { 
416420                    #[ inline] 
417421                    fn  cast_from_raw( a:  PtrInner <' _,  $atomic>)  -> PtrInner <' _,  $prim> { 
418422                        // SAFETY: The caller promised that `$atomic` and `$prim` 
@@ -422,7 +426,7 @@ mod atomics {
422426                    } 
423427                } 
424428                // SAFETY: See previous safety comment. 
425-                 unsafe  impl <$( $tyvar) ?> SizeCompat <$prim> for  $atomic { 
429+                 unsafe  impl <$( $tyvar) ?> SizeFrom <$prim> for  $atomic { 
426430                    #[ inline] 
427431                    fn  cast_from_raw( p:  PtrInner <' _,  $prim>)  -> PtrInner <' _,  $atomic> { 
428432                        // SAFETY: See previous safety comment. 
@@ -440,28 +444,27 @@ mod atomics {
440444                //   `UnsafeCell<T>` has the same in-memory representation as 
441445                //   its inner type `T`. A consequence of this guarantee is that 
442446                //   it is possible to convert between `T` and `UnsafeCell<T>`. 
443-                 unsafe  impl <$( $tyvar) ?> SizeCompat <$atomic> for  UnsafeCell <$prim> { 
447+                 unsafe  impl <$( $tyvar) ?> SizeFrom <$atomic> for  UnsafeCell <$prim> { 
444448                    #[ inline] 
445449                    fn  cast_from_raw( a:  PtrInner <' _,  $atomic>)  -> PtrInner <' _,  UnsafeCell <$prim>> { 
446450                        // SAFETY: See previous safety comment. 
447451                        unsafe  {  cast!( a)  } 
448452                    } 
449453                } 
450454                // SAFETY: See previous safety comment. 
451-                 unsafe  impl <$( $tyvar) ?> SizeCompat <UnsafeCell <$prim>> for  $atomic { 
455+                 unsafe  impl <$( $tyvar) ?> SizeFrom <UnsafeCell <$prim>> for  $atomic { 
452456                    #[ inline] 
453457                    fn  cast_from_raw( p:  PtrInner <' _,  UnsafeCell <$prim>>)  -> PtrInner <' _,  $atomic> { 
454458                        // SAFETY: See previous safety comment. 
455459                        unsafe  {  cast!( p)  } 
456460                    } 
457461                } 
458462
459-                 // SAFETY: The caller promised that `$atomic` and `$prim` 
460-                 // have the same bit validity. `UnsafeCell<T>` has the same 
461-                 // bit validity as `T` [1]. `UnsafeCell<T>` also has the 
462-                 // same size as `T` [1], and so both impls of 
463-                 // `SizeCompat::cast_from_raw` preserve referent size 
464-                 // exactly. 
463+                 // SAFETY: The caller promised that `$atomic` and `$prim` have 
464+                 // the same bit validity. `UnsafeCell<T>` has the same bit 
465+                 // validity as `T` [1]. `UnsafeCell<T>` also has the same size 
466+                 // as `T` [1], and so both impls of `SizeFrom::cast_from_raw` 
467+                 // preserve referent size exactly. 
465468                // 
466469                // [1] Per https://doc.rust-lang.org/1.85.0/std/cell/struct.UnsafeCell.html#memory-layout: 
467470                // 
0 commit comments