File tree Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Original file line number Diff line number Diff line change @@ -170,6 +170,7 @@ unsafe impl CheckedBitPattern for bool {
170
170
}
171
171
}
172
172
173
+ // Rust 1.70.0 documents that NonZero[int] has the same layout as [int].
173
174
macro_rules! impl_checked_for_nonzero {
174
175
( $( $nonzero: ty: $primitive: ty) ,* $( , ) ?) => {
175
176
$(
@@ -178,14 +179,7 @@ macro_rules! impl_checked_for_nonzero {
178
179
179
180
#[ inline]
180
181
fn is_valid_bit_pattern( bits: & Self :: Bits ) -> bool {
181
- // Note(zachs18): The size and alignment check are almost certainly
182
- // not necessary, but Rust currently doesn't explicitly document that
183
- // NonZero[int] has the same layout as [int], so we check it to be safe.
184
- // In a const to reduce debug-profile overhead.
185
- const LAYOUT_SAME : bool =
186
- core:: mem:: size_of:: <$nonzero>( ) == core:: mem:: size_of:: <$primitive>( )
187
- && core:: mem:: align_of:: <$nonzero>( ) == core:: mem:: align_of:: <$primitive>( ) ;
188
- LAYOUT_SAME && * bits != 0
182
+ * bits != 0
189
183
}
190
184
}
191
185
) *
You can’t perform that action at this time.
0 commit comments