Use inline const instead of unsafe to implement `MaybeUninit::uninit_… · model-checking/verify-rust-std@14a6f29 (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Commit 14a6f29
Use inline const instead of unsafe to implement MaybeUninit::uninit_array()
.
File tree
1 file changed
lines changed
1 file changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -342,8 +342,7 @@ impl MaybeUninit { | ||
342 | 342 | #[must_use] |
343 | 343 | #[inline(always)] |
344 | 344 | pub const fn uninit_array<const N: usize>() -> [Self; N] { |
345 | -// SAFETY: An uninitialized `[MaybeUninit<_>; LEN]` is valid. | |
346 | -unsafe { MaybeUninit::<[MaybeUninit<T>; N]>::uninit().assume_init() } | |
345 | +[const { MaybeUninit::uninit() }; N] | |
347 | 346 | } |
348 | 347 | |
349 | 348 | /// Creates a new `MaybeUninit` in an uninitialized state, with the memory being |