Use inline const instead of unsafe to implement `MaybeUninit::uninit_… · model-checking/verify-rust-std@14a6f29 (original) (raw)
Navigation Menu
- GitHub Copilot Write better code with AI
- GitHub Models New Manage and compare prompts
- GitHub Advanced Security Find and fix vulnerabilities
- Actions Automate any workflow
- Codespaces Instant dev environments
- Issues Plan and track work
- Code Review Manage code changes
- Discussions Collaborate outside of code
- Code Search Find more, search less
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
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
Lines changed: 1 addition & 2 deletions
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 |