Skip to content

Commit 723dc1c

Browse files
Rollup merge of #129401 - workingjubilee:partial-initialization-of-stabilization, r=dtolnay,joboet
Partially stabilize `feature(new_uninit)` Finished comment period: rust-lang/rust#63291 (comment) The following API has been stabilized from rust-lang/rust#63291 ```rust impl<T> Box<T> { pub fn new_uninit() -> Box<MaybeUninit<T>> {…} } impl<T> Rc<T> { pub fn new_uninit() -> Rc<MaybeUninit<T>> {…} } impl<T> Arc<T> { pub fn new_uninit() -> Arc<MaybeUninit<T>> {…} } impl<T> Box<[T]> { pub fn new_uninit_slice(len: usize) -> Box<[MaybeUninit<T>]> {…} } impl<T> Rc<[T]> { pub fn new_uninit_slice(len: usize) -> Rc<[MaybeUninit<T>]> {…} } impl<T> Arc<[T]> { pub fn new_uninit_slice(len: usize) -> Arc<[MaybeUninit<T>]> {…} } impl<T> Box<MaybeUninit<T>> { pub unsafe fn assume_init(self) -> Box<T> {…} } impl<T> Box<[MaybeUninit<T>]> { pub unsafe fn assume_init(self) -> Box<[T]> {…} } impl<T> Rc<MaybeUninit<T>> { pub unsafe fn assume_init(self) -> Rc<T> {…} } impl<T> Rc<[MaybeUninit<T>]> { pub unsafe fn assume_init(self) -> Rc<[T]> {…} } impl<T> Arc<MaybeUninit<T>> { pub unsafe fn assume_init(self) -> Arc<T> {…} } impl<T> Arc<[MaybeUninit<T>]> { pub unsafe fn assume_init(self) -> Arc<[T]> {…} } ``` The remaining API is split between new issues - `new_zeroed_alloc`: rust-lang/rust#129396 - `box_uninit_write`: rust-lang/rust#129397 All relevant code is thus either stabilized or split out of that issue, so this closes #63291 as, with the FCP concluded, that issue has served its purpose. try-job: x86_64-rust-for-linux
2 parents 2eb0f98 + 65280f9 commit 723dc1c

File tree

5 files changed

+0
-5
lines changed

5 files changed

+0
-5
lines changed

tests/fail/data_race/alloc_read_race.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//@compile-flags: -Zmiri-disable-weak-memory-emulation -Zmiri-preemption-rate=0 -Zmiri-disable-stacked-borrows
22
// Avoid accidental synchronization via address reuse inside `thread::spawn`.
33
//@compile-flags: -Zmiri-address-reuse-cross-thread-rate=0
4-
#![feature(new_uninit)]
54

65
use std::mem::MaybeUninit;
76
use std::ptr::null_mut;

tests/fail/data_race/alloc_write_race.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//@compile-flags: -Zmiri-disable-weak-memory-emulation -Zmiri-preemption-rate=0 -Zmiri-disable-stacked-borrows
22
// Avoid accidental synchronization via address reuse inside `thread::spawn`.
33
//@compile-flags: -Zmiri-address-reuse-cross-thread-rate=0
4-
#![feature(new_uninit)]
54

65
use std::ptr::null_mut;
76
use std::sync::atomic::{AtomicPtr, Ordering};

tests/fail/weak_memory/weak_uninit.rs

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
// run multiple times until one try returns true.
77
// Spurious failure is possible, if you are really unlucky with
88
// the RNG and always read the latest value from the store buffer.
9-
#![feature(new_uninit)]
109

1110
use std::sync::atomic::*;
1211
use std::thread::spawn;

tests/pass/rc.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//@revisions: stack tree
22
//@[tree]compile-flags: -Zmiri-tree-borrows
33
//@compile-flags: -Zmiri-strict-provenance
4-
#![feature(new_uninit)]
54
#![feature(get_mut_unchecked)]
65
#![allow(ambiguous_wide_pointer_comparisons)]
76

tests/pass/slices.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//@revisions: stack tree
22
//@[tree]compile-flags: -Zmiri-tree-borrows
33
//@compile-flags: -Zmiri-strict-provenance
4-
#![feature(new_uninit)]
54
#![feature(slice_as_chunks)]
65
#![feature(slice_partition_dedup)]
76
#![feature(layout_for_ptr)]

0 commit comments

Comments
 (0)