library: Stabilize new_uninit for Box, Rc, and Arc · patricklam/verify-rust-std@9876bd1 (original) (raw)

`@@ -262,8 +262,6 @@ impl Box {

`

262

262

`/// # Examples

`

263

263

`///

`

264

264

```` /// ```


`265`

``

`-

/// #![feature(new_uninit)]

`

`266`

``

`-

///

`

`267`

`265`

`/// let mut five = Box::<u32>::new_uninit();

`

`268`

`266`

`///

`

`269`

`267`

`/// let five = unsafe {

`

`@@ -276,7 +274,7 @@ impl<T> Box<T> {

`

`276`

`274`

`/// assert_eq!(*five, 5)

`

`277`

`275`

```` /// ```

278

276

`#[cfg(not(no_global_oom_handling))]

`

279

``

`-

#[unstable(feature = "new_uninit", issue = "63291")]

`

``

277

`+

#[stable(feature = "new_uninit", since = "CURRENT_RUSTC_VERSION")]

`

280

278

`#[must_use]

`

281

279

`#[inline]

`

282

280

`pub fn new_uninit() -> Box<mem::MaybeUninit> {

`

`@@ -292,7 +290,6 @@ impl Box {

`

292

290

`/// # Examples

`

293

291

`///

`

294

292

```` /// ```


`295`

``

`-

/// #![feature(new_uninit)]

`

`296`

`293`

`/// #![feature(new_zeroed_alloc)]

`

`297`

`294`

`///

`

`298`

`295`

`/// let zero = Box::<u32>::new_zeroed();

`

`@@ -350,7 +347,7 @@ impl<T> Box<T> {

`

`350`

`347`

`/// # Examples

`

`351`

`348`

`///

`

`352`

`349`

```` /// ```

353

``

`-

/// #![feature(allocator_api, new_uninit)]

`

``

350

`+

/// #![feature(allocator_api)]

`

354

351

`///

`

355

352

`/// let mut five = Box::::try_new_uninit()?;

`

356

353

`///

`

`@@ -380,7 +377,7 @@ impl Box {

`

380

377

`/// # Examples

`

381

378

`///

`

382

379

```` /// ```


`383`

``

`-

/// #![feature(allocator_api, new_uninit)]

`

``

`380`

`+

/// #![feature(allocator_api)]

`

`384`

`381`

`///

`

`385`

`382`

`/// let zero = Box::<u32>::try_new_zeroed()?;

`

`386`

`383`

`/// let zero = unsafe { zero.assume_init() };

`

`@@ -460,7 +457,7 @@ impl<T, A: Allocator> Box<T, A> {

`

`460`

`457`

`/// # Examples

`

`461`

`458`

`///

`

`462`

`459`

```` /// ```

463

``

`-

/// #![feature(allocator_api, new_uninit)]

`

``

460

`+

/// #![feature(allocator_api)]

`

464

461

`///

`

465

462

`/// use std::alloc::System;

`

466

463

`///

`

`@@ -498,7 +495,7 @@ impl<T, A: Allocator> Box<T, A> {

`

498

495

`/// # Examples

`

499

496

`///

`

500

497

```` /// ```


`501`

``

`-

/// #![feature(allocator_api, new_uninit)]

`

``

`498`

`+

/// #![feature(allocator_api)]

`

`502`

`499`

`///

`

`503`

`500`

`/// use std::alloc::System;

`

`504`

`501`

`///

`

`@@ -538,7 +535,7 @@ impl<T, A: Allocator> Box<T, A> {

`

`538`

`535`

`/// # Examples

`

`539`

`536`

`///

`

`540`

`537`

```` /// ```

541

``

`-

/// #![feature(allocator_api, new_uninit)]

`

``

538

`+

/// #![feature(allocator_api)]

`

542

539

`///

`

543

540

`/// use std::alloc::System;

`

544

541

`///

`

`@@ -576,7 +573,7 @@ impl<T, A: Allocator> Box<T, A> {

`

576

573

`/// # Examples

`

577

574

`///

`

578

575

```` /// ```


`579`

``

`-

/// #![feature(allocator_api, new_uninit)]

`

``

`576`

`+

/// #![feature(allocator_api)]

`

`580`

`577`

`///

`

`581`

`578`

`/// use std::alloc::System;

`

`582`

`579`

`///

`

`@@ -654,8 +651,6 @@ impl<T> Box<[T]> {

`

`654`

`651`

`/// # Examples

`

`655`

`652`

`///

`

`656`

`653`

```` /// ```

657

``

`-

/// #![feature(new_uninit)]

`

658

``

`-

///

`

659

654

`/// let mut values = Box::<[u32]>::new_uninit_slice(3);

`

660

655

`///

`

661

656

`/// let values = unsafe {

`

`@@ -670,7 +665,7 @@ impl Box<[T]> {

`

670

665

`/// assert_eq!(*values, [1, 2, 3])

`

671

666

```` /// ```


`672`

`667`

`#[cfg(not(no_global_oom_handling))]

`

`673`

``

`-

#[unstable(feature = "new_uninit", issue = "63291")]

`

``

`668`

`+

#[stable(feature = "new_uninit", since = "CURRENT_RUSTC_VERSION")]

`

`674`

`669`

`#[must_use]

`

`675`

`670`

`pub fn new_uninit_slice(len: usize) -> Box<[mem::MaybeUninit<T>]> {

`

`676`

`671`

`unsafe { RawVec::with_capacity(len).into_box(len) }

`

`@@ -686,7 +681,6 @@ impl<T> Box<[T]> {

`

`686`

`681`

`///

`

`687`

`682`

```` /// ```

688

683

`/// #![feature(new_zeroed_alloc)]

`

689

``

`-

/// #![feature(new_uninit)]

`

690

684

`///

`

691

685

`/// let values = Box::<[u32]>::new_zeroed_slice(3);

`

692

686

`/// let values = unsafe { values.assume_init() };

`

`@@ -708,7 +702,7 @@ impl Box<[T]> {

`

708

702

`/// # Examples

`

709

703

`///

`

710

704

```` /// ```


`711`

``

`-

/// #![feature(allocator_api, new_uninit)]

`

``

`705`

`+

/// #![feature(allocator_api)]

`

`712`

`706`

`///

`

`713`

`707`

`/// let mut values = Box::<[u32]>::try_new_uninit_slice(3)?;

`

`714`

`708`

`/// let values = unsafe {

`

`@@ -746,7 +740,7 @@ impl<T> Box<[T]> {

`

`746`

`740`

`/// # Examples

`

`747`

`741`

`///

`

`748`

`742`

```` /// ```

749

``

`-

/// #![feature(allocator_api, new_uninit)]

`

``

743

`+

/// #![feature(allocator_api)]

`

750

744

`///

`

751

745

`/// let values = Box::<[u32]>::try_new_zeroed_slice(3)?;

`

752

746

`/// let values = unsafe { values.assume_init() };

`

`@@ -778,7 +772,7 @@ impl<T, A: Allocator> Box<[T], A> {

`

778

772

`/// # Examples

`

779

773

`///

`

780

774

```` /// ```


`781`

``

`-

/// #![feature(allocator_api, new_uninit)]

`

``

`775`

`+

/// #![feature(allocator_api)]

`

`782`

`776`

`///

`

`783`

`777`

`/// use std::alloc::System;

`

`784`

`778`

`///

`

`@@ -812,7 +806,7 @@ impl<T, A: Allocator> Box<[T], A> {

`

`812`

`806`

`/// # Examples

`

`813`

`807`

`///

`

`814`

`808`

```` /// ```

815

``

`-

/// #![feature(allocator_api, new_uninit)]

`

``

809

`+

/// #![feature(allocator_api)]

`

816

810

`///

`

817

811

`/// use std::alloc::System;

`

818

812

`///

`

`@@ -837,7 +831,7 @@ impl<T, A: Allocator> Box<[T], A> {

`

837

831

`/// # Examples

`

838

832

`///

`

839

833

```` /// ```


`840`

``

`-

/// #![feature(allocator_api, new_uninit)]

`

``

`834`

`+

/// #![feature(allocator_api)]

`

`841`

`835`

`///

`

`842`

`836`

`/// use std::alloc::System;

`

`843`

`837`

`///

`

`@@ -880,7 +874,7 @@ impl<T, A: Allocator> Box<[T], A> {

`

`880`

`874`

`/// # Examples

`

`881`

`875`

`///

`

`882`

`876`

```` /// ```

883

``

`-

/// #![feature(allocator_api, new_uninit)]

`

``

877

`+

/// #![feature(allocator_api)]

`

884

878

`///

`

885

879

`/// use std::alloc::System;

`

886

880

`///

`

`@@ -927,8 +921,6 @@ impl<T, A: Allocator> Box<mem::MaybeUninit, A> {

`

927

921

`/// # Examples

`

928

922

`///

`

929

923

```` /// ```


`930`

``

`-

/// #![feature(new_uninit)]

`

`931`

``

`-

///

`

`932`

`924`

`/// let mut five = Box::<u32>::new_uninit();

`

`933`

`925`

`///

`

`934`

`926`

`/// let five: Box<u32> = unsafe {

`

`@@ -940,7 +932,7 @@ impl<T, A: Allocator> Box<mem::MaybeUninit<T>, A> {

`

`940`

`932`

`///

`

`941`

`933`

`/// assert_eq!(*five, 5)

`

`942`

`934`

```` /// ```

943

``

`-

#[unstable(feature = "new_uninit", issue = "63291")]

`

``

935

`+

#[stable(feature = "new_uninit", since = "CURRENT_RUSTC_VERSION")]

`

944

936

`#[inline]

`

945

937

`pub unsafe fn assume_init(self) -> Box<T, A> {

`

946

938

`let (raw, alloc) = Box::into_raw_with_allocator(self);

`

`@@ -958,7 +950,6 @@ impl<T, A: Allocator> Box<mem::MaybeUninit, A> {

`

958

950

`///

`

959

951

```` /// ```


`960`

`952`

`/// #![feature(box_uninit_write)]

`

`961`

``

`-

/// #![feature(new_uninit)]

`

`962`

`953`

`///

`

`963`

`954`

`/// let big_box = Box::<[usize; 1024]>::new_uninit();

`

`964`

`955`

`///

`

`@@ -1001,8 +992,6 @@ impl<T, A: Allocator> Box<[mem::MaybeUninit<T>], A> {

`

`1001`

`992`

`/// # Examples

`

`1002`

`993`

`///

`

`1003`

`994`

```` /// ```

1004

``

`-

/// #![feature(new_uninit)]

`

1005

``

`-

///

`

1006

995

`/// let mut values = Box::<[u32]>::new_uninit_slice(3);

`

1007

996

`///

`

1008

997

`/// let values = unsafe {

`

`@@ -1016,7 +1005,7 @@ impl<T, A: Allocator> Box<[mem::MaybeUninit], A> {

`

1016

1005

`///

`

1017

1006

`/// assert_eq!(*values, [1, 2, 3])

`

1018

1007

```` /// ```

````

1019

``

`-

#[unstable(feature = "new_uninit", issue = "63291")]

`

``

1008

`+

#[stable(feature = "new_uninit", since = "CURRENT_RUSTC_VERSION")]

`

1020

1009

`#[inline]

`

1021

1010

`pub unsafe fn assume_init(self) -> Box<[T], A> {

`

1022

1011

`let (raw, alloc) = Box::into_raw_with_allocator(self);

`