Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit14a6f29

Browse files
committed
Use inline const instead of unsafe to implementMaybeUninit::uninit_array().
1 parenta2c3406 commit14a6f29

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

‎core/src/mem/maybe_uninit.rs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,7 @@ impl<T> MaybeUninit<T> {
342342
#[must_use]
343343
#[inline(always)]
344344
pubconstfnuninit_array<constN: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]
347346
}
348347

349348
/// Creates a new `MaybeUninit<T>` in an uninitialized state, with the memory being

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp