Skip to content

Commit 1975a6e

Browse files
committed
Constify MaybeUninit::assume_init_read
1 parent d4fd798 commit 1975a6e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

library/core/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
#![feature(const_precise_live_drops)]
9595
#![feature(const_ptr_offset)]
9696
#![feature(const_ptr_offset_from)]
97+
#![feature(const_ptr_read)]
9798
#![feature(const_raw_ptr_comparison)]
9899
#![feature(const_raw_ptr_deref)]
99100
#![feature(const_slice_from_raw_parts)]

library/core/src/mem/maybe_uninit.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -575,8 +575,9 @@ impl<T> MaybeUninit<T> {
575575
/// // they both get dropped!
576576
/// ```
577577
#[unstable(feature = "maybe_uninit_extra", issue = "63567")]
578+
#[rustc_const_unstable(feature = "maybe_uninit_extra", issue = "63567")]
578579
#[inline(always)]
579-
pub unsafe fn assume_init_read(&self) -> T {
580+
pub const unsafe fn assume_init_read(&self) -> T {
580581
// SAFETY: the caller must guarantee that `self` is initialized.
581582
// Reading from `self.as_ptr()` is safe since `self` should be initialized.
582583
unsafe {

0 commit comments

Comments
 (0)