Constify MaybeUninit::assume_init_read

This commit is contained in:
Albin Hedman
2020-12-26 01:27:13 +01:00
parent d4fd7987b5
commit 1975a6e710
2 changed files with 3 additions and 1 deletions
+1
View File
@@ -94,6 +94,7 @@
#![feature(const_precise_live_drops)]
#![feature(const_ptr_offset)]
#![feature(const_ptr_offset_from)]
#![feature(const_ptr_read)]
#![feature(const_raw_ptr_comparison)]
#![feature(const_raw_ptr_deref)]
#![feature(const_slice_from_raw_parts)]
+2 -1
View File
@@ -575,8 +575,9 @@ pub const fn as_mut_ptr(&mut self) -> *mut T {
/// // they both get dropped!
/// ```
#[unstable(feature = "maybe_uninit_extra", issue = "63567")]
#[rustc_const_unstable(feature = "maybe_uninit_extra", issue = "63567")]
#[inline(always)]
pub unsafe fn assume_init_read(&self) -> T {
pub const unsafe fn assume_init_read(&self) -> T {
// SAFETY: the caller must guarantee that `self` is initialized.
// Reading from `self.as_ptr()` is safe since `self` should be initialized.
unsafe {