Skip to content

Commit

Permalink
Rollup merge of #125995 - kpreid:const-uninit-stable, r=Nilstrieb
Browse files Browse the repository at this point in the history
Use inline const blocks to create arrays of `MaybeUninit`.

This PR contains 2 changes enabled by the fact that [`inline_const` is now stable](rust-lang/rust#104087), and was split out of #125082.

1. Use inline const instead of `unsafe` to construct arrays in `MaybeUninit` examples.

   Rationale: Demonstrate good practice of avoiding `unsafe` code where it is not strictly necessary.

4. Use inline const instead of `unsafe` to implement `MaybeUninit::uninit_array()`.

    This is arguably giving the compiler more work to do, in exchange for eliminating just one single internal unsafe block, so it's less certain that this is good on net.

r​? `@Nilstrieb`
  • Loading branch information
workingjubilee committed Jun 5, 2024
2 parents 8c8707c 29656ae commit c792959
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit c792959

Please sign in to comment.