@@ -100,32 +100,14 @@ safety_comment! {
100100( bool :  Immutable ,  FromZeros ,  IntoBytes ,  Unaligned ) ; 
101101    assert_unaligned!( bool ) ; 
102102    /// SAFETY: 
103- /// - The safety requirements for `unsafe_impl!` with an `is_bit_valid` 
104- ///   closure: 
105- ///   - Given `t: *mut bool` and `let r = *mut u8`, `r` refers to an object 
106- ///     of the same size as that referred to by `t`. This is true because 
107- ///     `bool` and `u8` have the same size (1 byte) [1]. Neither `r` nor `t` 
108- ///     contain `UnsafeCell`s because neither `bool` nor `u8` do [3]. 
109- ///   - The impl must only return `true` for its argument if the original 
110- ///     `Maybe<bool>` refers to a valid `bool`. We only return true if the 
111- ///     `u8` value is 0 or 1, and both of these are valid values for `bool`. 
112- ///     [2] 
103+ /// The impl must only return `true` for its argument if the original 
104+ /// `Maybe<bool>` refers to a valid `bool`. We only return true if the `u8` 
105+ /// value is 0 or 1, and both of these are valid values for `bool` [1]. 
113106/// 
114- /// [1] Per https://doc.rust-lang.org/1.81.0/reference/type-layout.html#primitive-data-layout: 
115- /// 
116- ///   The size of most primitives is given in this table. 
117- /// 
118- ///   | Type      | `size_of::<Type>() ` | 
119- ///   |-----------|----------------------| 
120- ///   | `bool`    | 1                    | 
121- ///   | `u8`/`i8` | 1                    | 
122- /// 
123- /// [2] Per https://doc.rust-lang.org/1.81.0/reference/types/boolean.html: 
107+ /// [1] Per https://doc.rust-lang.org/1.81.0/reference/types/boolean.html: 
124108/// 
125109///   The value false has the bit pattern 0x00 and the value true has the 
126110///   bit pattern 0x01. 
127- /// 
128- /// [3] TODO(#429): Justify this claim. 
129111( => TryFromBytes  for  bool ;  |byte| { 
130112        let  byte = byte. transmute:: <u8 ,  invariant:: Valid ,  _>( ) ; 
131113        * byte. unaligned_as_ref( )  < 2 
@@ -148,27 +130,14 @@ safety_comment! {
148130/// [1] https://doc.rust-lang.org/1.81.0/reference/types/textual.html 
149131( char :  Immutable ,  FromZeros ,  IntoBytes ) ; 
150132    /// SAFETY: 
151- /// - The safety requirements for `unsafe_impl!` with an `is_bit_valid` 
152- ///   closure: 
153- ///   - Given `t: *mut char` and `let r = *mut u32`, `r` refers to an object 
154- ///     of the same size as that referred to by `t`. This is true because 
155- ///     `char` and `u32` have the same size [1]. Neither `r` nor `t` contain 
156- ///     `UnsafeCell`s because neither `char` nor `u32` do [3]. 
157- ///   - The impl must only return `true` for its argument if the original 
158- ///     `Maybe<char>` refers to a valid `char`. `char::from_u32` guarantees 
159- ///     that it returns `None` if its input is not a valid `char`. [2] 
133+ /// The impl must only return `true` for its argument if the original 
134+ /// `Maybe<char>` refers to a valid `char`. `char::from_u32` guarantees that 
135+ /// it returns `None` if its input is not a valid `char` [1]. 
160136/// 
161- /// [1] Per https://doc.rust-lang.org/nightly/reference/types/textual.html#layout-and-bit-validity: 
162- /// 
163- ///   `char` is guaranteed to have the same size and alignment as `u32` on 
164- ///   all platforms. 
165- /// 
166- /// [2] Per https://doc.rust-lang.org/core/primitive.char.html#method.from_u32: 
137+ /// [1] Per https://doc.rust-lang.org/core/primitive.char.html#method.from_u32: 
167138/// 
168139///   `from_u32()` will return `None` if the input is not a valid value for 
169140///   a `char`. 
170- /// 
171- /// [3] TODO(#429): Justify this claim. 
172141( => TryFromBytes  for  char ;  |c| { 
173142        let  c = c. transmute:: <Unalign <u32 >,  invariant:: Valid ,  _>( ) ; 
174143        let  c = c. read_unaligned( ) . into_inner( ) ; 
@@ -196,20 +165,9 @@ safety_comment! {
196165/// [1] https://doc.rust-lang.org/1.81.0/reference/type-layout.html#str-layout 
197166( str :  Immutable ,  FromZeros ,  IntoBytes ,  Unaligned ) ; 
198167    /// SAFETY: 
199- /// - The safety requirements for `unsafe_impl!` with an `is_bit_valid` 
200- ///   closure: 
201- ///   - Given `t: *mut str` and `let r = *mut [u8]`, `r` refers to an object 
202- ///     of the same size as that referred to by `t`. This is true because 
203- ///     `str` and `[u8]` have the same representation. [1] Neither `t` nor 
204- ///     `r` contain `UnsafeCell`s because `[u8]` doesn't, and both `t` and 
205- ///     `r` have that representation. 
206- ///   - The impl must only return `true` for its argument if the original 
207- ///     `Maybe<str>` refers to a valid `str`. `str::from_utf8` guarantees 
208- ///     that it returns `Err` if its input is not a valid `str`. [2] 
209- /// 
210- /// [1] Per https://doc.rust-lang.org/1.81.0/reference/types/textual.html: 
211- /// 
212- ///   A value of type `str` is represented the same was as `[u8]`. 
168+ /// The impl must only return `true` for its argument if the original 
169+ /// `Maybe<str>` refers to a valid `str`. `str::from_utf8` guarantees that 
170+ /// it returns `Err` if its input is not a valid `str` [1]. 
213171/// 
214172/// [2] Per https://doc.rust-lang.org/core/str/fn.from_utf8.html#errors: 
215173/// 
@@ -307,25 +265,6 @@ safety_comment! {
307265    unsafe_impl!( NonZeroI128 :  Immutable ,  IntoBytes ) ; 
308266    unsafe_impl!( NonZeroUsize :  Immutable ,  IntoBytes ) ; 
309267    unsafe_impl!( NonZeroIsize :  Immutable ,  IntoBytes ) ; 
310-     /// SAFETY: 
311- /// - The safety requirements for `unsafe_impl!` with an `is_bit_valid` 
312- ///   closure: 
313- ///   - Given `t: *mut NonZeroXxx` and `let r = *mut xxx`, `r` refers to an 
314- ///     object of the same size as that referred to by `t`. This is true 
315- ///     because `NonZeroXxx` and `xxx` have the same size. [1] Neither `r` 
316- ///     nor `t` refer to any `UnsafeCell`s because neither `NonZeroXxx` [2] 
317- ///     nor `xxx` do. 
318- ///   - The impl must only return `true` for its argument if the original 
319- ///     `Maybe<NonZeroXxx>` refers to a valid `NonZeroXxx`. The only `xxx` 
320- ///     which is not also a valid `NonZeroXxx` is 0. [1] 
321- /// 
322- /// [1] Per https://doc.rust-lang.org/1.81.0/core/num/type.NonZeroU16.html: 
323- /// 
324- ///   `NonZeroU16` is guaranteed to have the same layout and bit validity as 
325- ///   `u16` with the exception that `0` is not a valid instance. 
326- /// 
327- /// [2] `NonZeroXxx` self-evidently does not contain `UnsafeCell`s. This is 
328- ///     not a proof, but we are accepting this as a known risk per #1358. 
329268    unsafe_impl_try_from_bytes_for_nonzero!( 
330269        NonZeroU8 [ u8 ] , 
331270        NonZeroI8 [ i8 ] , 
0 commit comments