@@ -180,7 +180,7 @@ safety_comment! {
180180 ///
181181 /// [4] TODO(#429): Justify this claim.
182182 unsafe_impl!( char : TryFromBytes ; |candidate: MaybeAligned <u32 >| {
183- let candidate = candidate. read_unaligned( ) ;
183+ let candidate = candidate. read_unaligned:: < BecauseImmutable > ( ) ;
184184 char :: from_u32( candidate) . is_some( )
185185 } ) ;
186186}
@@ -310,18 +310,18 @@ safety_comment! {
310310 ///
311311 /// [2] `NonZeroXxx` self-evidently does not contain `UnsafeCell`s. This is
312312 /// not a proof, but we are accepting this as a known risk per #1358.
313- unsafe_impl!( NonZeroU8 : TryFromBytes ; |n: MaybeAligned <u8 >| NonZeroU8 :: new( n. read_unaligned( ) ) . is_some( ) ) ;
314- unsafe_impl!( NonZeroI8 : TryFromBytes ; |n: MaybeAligned <i8 >| NonZeroI8 :: new( n. read_unaligned( ) ) . is_some( ) ) ;
315- unsafe_impl!( NonZeroU16 : TryFromBytes ; |n: MaybeAligned <u16 >| NonZeroU16 :: new( n. read_unaligned( ) ) . is_some( ) ) ;
316- unsafe_impl!( NonZeroI16 : TryFromBytes ; |n: MaybeAligned <i16 >| NonZeroI16 :: new( n. read_unaligned( ) ) . is_some( ) ) ;
317- unsafe_impl!( NonZeroU32 : TryFromBytes ; |n: MaybeAligned <u32 >| NonZeroU32 :: new( n. read_unaligned( ) ) . is_some( ) ) ;
318- unsafe_impl!( NonZeroI32 : TryFromBytes ; |n: MaybeAligned <i32 >| NonZeroI32 :: new( n. read_unaligned( ) ) . is_some( ) ) ;
319- unsafe_impl!( NonZeroU64 : TryFromBytes ; |n: MaybeAligned <u64 >| NonZeroU64 :: new( n. read_unaligned( ) ) . is_some( ) ) ;
320- unsafe_impl!( NonZeroI64 : TryFromBytes ; |n: MaybeAligned <i64 >| NonZeroI64 :: new( n. read_unaligned( ) ) . is_some( ) ) ;
321- unsafe_impl!( NonZeroU128 : TryFromBytes ; |n: MaybeAligned <u128 >| NonZeroU128 :: new( n. read_unaligned( ) ) . is_some( ) ) ;
322- unsafe_impl!( NonZeroI128 : TryFromBytes ; |n: MaybeAligned <i128 >| NonZeroI128 :: new( n. read_unaligned( ) ) . is_some( ) ) ;
323- unsafe_impl!( NonZeroUsize : TryFromBytes ; |n: MaybeAligned <usize >| NonZeroUsize :: new( n. read_unaligned( ) ) . is_some( ) ) ;
324- unsafe_impl!( NonZeroIsize : TryFromBytes ; |n: MaybeAligned <isize >| NonZeroIsize :: new( n. read_unaligned( ) ) . is_some( ) ) ;
313+ unsafe_impl!( NonZeroU8 : TryFromBytes ; |n: MaybeAligned <u8 >| NonZeroU8 :: new( n. read_unaligned:: < BecauseImmutable > ( ) ) . is_some( ) ) ;
314+ unsafe_impl!( NonZeroI8 : TryFromBytes ; |n: MaybeAligned <i8 >| NonZeroI8 :: new( n. read_unaligned:: < BecauseImmutable > ( ) ) . is_some( ) ) ;
315+ unsafe_impl!( NonZeroU16 : TryFromBytes ; |n: MaybeAligned <u16 >| NonZeroU16 :: new( n. read_unaligned:: < BecauseImmutable > ( ) ) . is_some( ) ) ;
316+ unsafe_impl!( NonZeroI16 : TryFromBytes ; |n: MaybeAligned <i16 >| NonZeroI16 :: new( n. read_unaligned:: < BecauseImmutable > ( ) ) . is_some( ) ) ;
317+ unsafe_impl!( NonZeroU32 : TryFromBytes ; |n: MaybeAligned <u32 >| NonZeroU32 :: new( n. read_unaligned:: < BecauseImmutable > ( ) ) . is_some( ) ) ;
318+ unsafe_impl!( NonZeroI32 : TryFromBytes ; |n: MaybeAligned <i32 >| NonZeroI32 :: new( n. read_unaligned:: < BecauseImmutable > ( ) ) . is_some( ) ) ;
319+ unsafe_impl!( NonZeroU64 : TryFromBytes ; |n: MaybeAligned <u64 >| NonZeroU64 :: new( n. read_unaligned:: < BecauseImmutable > ( ) ) . is_some( ) ) ;
320+ unsafe_impl!( NonZeroI64 : TryFromBytes ; |n: MaybeAligned <i64 >| NonZeroI64 :: new( n. read_unaligned:: < BecauseImmutable > ( ) ) . is_some( ) ) ;
321+ unsafe_impl!( NonZeroU128 : TryFromBytes ; |n: MaybeAligned <u128 >| NonZeroU128 :: new( n. read_unaligned:: < BecauseImmutable > ( ) ) . is_some( ) ) ;
322+ unsafe_impl!( NonZeroI128 : TryFromBytes ; |n: MaybeAligned <i128 >| NonZeroI128 :: new( n. read_unaligned:: < BecauseImmutable > ( ) ) . is_some( ) ) ;
323+ unsafe_impl!( NonZeroUsize : TryFromBytes ; |n: MaybeAligned <usize >| NonZeroUsize :: new( n. read_unaligned:: < BecauseImmutable > ( ) ) . is_some( ) ) ;
324+ unsafe_impl!( NonZeroIsize : TryFromBytes ; |n: MaybeAligned <isize >| NonZeroIsize :: new( n. read_unaligned:: < BecauseImmutable > ( ) ) . is_some( ) ) ;
325325}
326326safety_comment ! {
327327 /// SAFETY:
0 commit comments