diff --git a/compiler/rustc_data_structures/src/lib.rs b/compiler/rustc_data_structures/src/lib.rs index 9714fb2123b08..49a847f7cd6e5 100644 --- a/compiler/rustc_data_structures/src/lib.rs +++ b/compiler/rustc_data_structures/src/lib.rs @@ -10,9 +10,10 @@ #![allow(internal_features)] #![allow(rustc::default_hash_types)] #![allow(rustc::potential_query_instability)] +#![cfg_attr(bootstrap, feature(allocator_api))] +#![cfg_attr(not(bootstrap), feature(allocator_ext))] #![cfg_attr(test, feature(test))] #![deny(unsafe_op_in_unsafe_fn)] -#![feature(allocator_api)] #![feature(ascii_char)] #![feature(ascii_char_variants)] #![feature(auto_traits)] diff --git a/compiler/rustc_middle/src/lib.rs b/compiler/rustc_middle/src/lib.rs index 0f30498ee09cb..d68183049e0e0 100644 --- a/compiler/rustc_middle/src/lib.rs +++ b/compiler/rustc_middle/src/lib.rs @@ -27,8 +27,9 @@ // tidy-alphabetical-start #![allow(internal_features)] #![allow(rustc::direct_use_of_rustc_type_ir)] +#![cfg_attr(bootstrap, feature(allocator_api))] #![cfg_attr(doc, feature(intra_doc_pointers))] -#![feature(allocator_api)] +#![cfg_attr(not(bootstrap), feature(allocator_ext))] #![feature(associated_type_defaults)] #![feature(closure_track_caller)] #![feature(const_default)] diff --git a/library/alloc/src/alloc.rs b/library/alloc/src/alloc.rs index c0d7d8b605227..1e3fd0f4b55e1 100644 --- a/library/alloc/src/alloc.rs +++ b/library/alloc/src/alloc.rs @@ -51,17 +51,17 @@ unsafe extern "Rust" { /// /// Note: while this type is unstable, the functionality it provides can be /// accessed through the [free functions in `alloc`](self#functions). -#[unstable(feature = "allocator_api", issue = "32838")] +#[stable(feature = "allocator_api", since = "CURRENT_RUSTC_VERSION")] #[derive(Copy, Debug)] #[derive_const(Clone, Default)] // the compiler needs to know when a Box uses the global allocator vs a custom one #[lang = "global_alloc_ty"] pub struct Global; -#[unstable(feature = "allocator_api", issue = "32838")] +#[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] unsafe impl core::alloc::AllocatorClone for Global {} -#[unstable(feature = "allocator_api", issue = "32838")] +#[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] unsafe impl core::alloc::StaticAllocator for Global {} /// Allocates memory with the global allocator. @@ -532,7 +532,7 @@ impl Global { } } -#[unstable(feature = "allocator_api", issue = "32838")] +#[stable(feature = "allocator_api", since = "CURRENT_RUSTC_VERSION")] #[rustc_const_unstable(feature = "const_heap", issue = "79597")] const unsafe impl Allocator for Global { #[inline] diff --git a/library/alloc/src/boxed.rs b/library/alloc/src/boxed.rs index bf91ac9dc3e74..9b4c9b31ef953 100644 --- a/library/alloc/src/boxed.rs +++ b/library/alloc/src/boxed.rs @@ -235,7 +235,7 @@ pub use thin::ThinBox; // compiler or ICEs will happen. pub struct Box< T: ?Sized, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[stable(feature = "allocator_api", since = "CURRENT_RUSTC_VERSION")] A: Allocator = Global, >(Unique, A); /// Monomorphic function for allocating an uninit `Box`. @@ -369,12 +369,12 @@ impl Box { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// let five = Box::try_new(5)?; /// # Ok::<(), std::alloc::AllocError>(()) /// ``` - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn try_new(x: T) -> Result { Self::try_new_in(x, Global) @@ -386,7 +386,7 @@ impl Box { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// let mut five = Box::::try_new_uninit()?; /// // Deferred initialization: @@ -396,7 +396,7 @@ impl Box { /// assert_eq!(*five, 5); /// # Ok::<(), std::alloc::AllocError>(()) /// ``` - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn try_new_uninit() -> Result>, AllocError> { Box::try_new_uninit_in(Global) @@ -411,7 +411,7 @@ impl Box { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// let zero = Box::::try_new_zeroed()?; /// let zero = unsafe { zero.assume_init() }; @@ -421,7 +421,7 @@ impl Box { /// ``` /// /// [zeroed]: mem::MaybeUninit::zeroed - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn try_new_zeroed() -> Result>, AllocError> { Box::try_new_zeroed_in(Global) @@ -512,14 +512,12 @@ impl Box { /// # Examples /// /// ``` - /// #![feature(allocator_api)] - /// /// use std::alloc::System; /// /// let five = Box::new_in(5, System); /// ``` #[cfg(not(no_global_oom_handling))] - #[unstable(feature = "allocator_api", issue = "32838")] + #[stable(feature = "allocator_api", since = "CURRENT_RUSTC_VERSION")] #[must_use] #[inline] pub fn new_in(x: T, alloc: A) -> Self @@ -539,14 +537,14 @@ impl Box { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::alloc::System; /// /// let five = Box::try_new_in(5, System)?; /// # Ok::<(), std::alloc::AllocError>(()) /// ``` - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn try_new_in(x: T, alloc: A) -> Result where @@ -562,7 +560,7 @@ impl Box { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::alloc::System; /// @@ -573,7 +571,7 @@ impl Box { /// /// assert_eq!(*five, 5) /// ``` - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[cfg(not(no_global_oom_handling))] #[must_use] pub fn new_uninit_in(alloc: A) -> Box, A> @@ -595,7 +593,7 @@ impl Box { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::alloc::System; /// @@ -607,7 +605,7 @@ impl Box { /// assert_eq!(*five, 5); /// # Ok::<(), std::alloc::AllocError>(()) /// ``` - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn try_new_uninit_in(alloc: A) -> Result, A>, AllocError> where A: Allocator, @@ -630,7 +628,7 @@ impl Box { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::alloc::System; /// @@ -641,7 +639,7 @@ impl Box { /// ``` /// /// [zeroed]: mem::MaybeUninit::zeroed - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[cfg(not(no_global_oom_handling))] #[must_use] pub fn new_zeroed_in(alloc: A) -> Box, A> @@ -667,7 +665,7 @@ impl Box { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::alloc::System; /// @@ -679,7 +677,7 @@ impl Box { /// ``` /// /// [zeroed]: mem::MaybeUninit::zeroed - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn try_new_zeroed_in(alloc: A) -> Result, A>, AllocError> where A: Allocator, @@ -704,13 +702,13 @@ impl Box { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// use std::alloc::System; /// /// let x = Box::pin_in(1, System); /// ``` #[cfg(not(no_global_oom_handling))] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[must_use] #[inline(always)] pub fn pin_in(x: T, alloc: A) -> Pin @@ -806,13 +804,12 @@ impl Box { /// /// ``` /// #![feature(clone_from_ref)] - /// #![feature(allocator_api)] /// /// let hello: Box = Box::try_clone_from_ref("hello")?; /// # Ok::<(), std::alloc::AllocError>(()) /// ``` #[unstable(feature = "clone_from_ref", issue = "149075")] - //#[unstable(feature = "allocator_api", issue = "32838")] + //#[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[must_use] #[inline] pub fn try_clone_from_ref(src: &T) -> Result, AllocError> { @@ -829,7 +826,6 @@ impl Box { /// /// ``` /// #![feature(clone_from_ref)] - /// #![feature(allocator_api)] /// /// use std::alloc::System; /// @@ -837,7 +833,7 @@ impl Box { /// ``` #[cfg(not(no_global_oom_handling))] #[unstable(feature = "clone_from_ref", issue = "149075")] - //#[unstable(feature = "allocator_api", issue = "32838")] + //#[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[must_use] #[inline] pub fn clone_from_ref_in(src: &T, alloc: A) -> Box { @@ -856,7 +852,6 @@ impl Box { /// /// ``` /// #![feature(clone_from_ref)] - /// #![feature(allocator_api)] /// /// use std::alloc::System; /// @@ -864,7 +859,7 @@ impl Box { /// # Ok::<(), std::alloc::AllocError>(()) /// ``` #[unstable(feature = "clone_from_ref", issue = "149075")] - //#[unstable(feature = "allocator_api", issue = "32838")] + //#[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[must_use] #[inline] pub fn try_clone_from_ref_in(src: &T, alloc: A) -> Result, AllocError> { @@ -951,7 +946,7 @@ impl Box<[T]> { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// let mut values = Box::<[u32]>::try_new_uninit_slice(3)?; /// // Deferred initialization: @@ -963,7 +958,7 @@ impl Box<[T]> { /// assert_eq!(*values, [1, 2, 3]); /// # Ok::<(), std::alloc::AllocError>(()) /// ``` - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn try_new_uninit_slice(len: usize) -> Result]>, AllocError> { let ptr = if T::IS_ZST || len == 0 { @@ -987,7 +982,7 @@ impl Box<[T]> { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// let values = Box::<[u32]>::try_new_zeroed_slice(3)?; /// let values = unsafe { values.assume_init() }; @@ -997,7 +992,7 @@ impl Box<[T]> { /// ``` /// /// [zeroed]: mem::MaybeUninit::zeroed - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn try_new_zeroed_slice(len: usize) -> Result]>, AllocError> { let ptr = if T::IS_ZST || len == 0 { @@ -1019,7 +1014,7 @@ impl Box<[T], A> { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::alloc::System; /// @@ -1033,7 +1028,7 @@ impl Box<[T], A> { /// assert_eq!(*values, [1, 2, 3]) /// ``` #[cfg(not(no_global_oom_handling))] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[must_use] pub fn new_uninit_slice_in(len: usize, alloc: A) -> Box<[mem::MaybeUninit], A> { unsafe { RawVec::with_capacity_in(len, alloc).into_box(len) } @@ -1048,7 +1043,7 @@ impl Box<[T], A> { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::alloc::System; /// @@ -1060,7 +1055,7 @@ impl Box<[T], A> { /// /// [zeroed]: mem::MaybeUninit::zeroed #[cfg(not(no_global_oom_handling))] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[must_use] pub fn new_zeroed_slice_in(len: usize, alloc: A) -> Box<[mem::MaybeUninit], A> { unsafe { RawVec::with_capacity_zeroed_in(len, alloc).into_box(len) } @@ -1072,7 +1067,7 @@ impl Box<[T], A> { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::alloc::System; /// @@ -1086,7 +1081,7 @@ impl Box<[T], A> { /// assert_eq!(*values, [1, 2, 3]); /// # Ok::<(), std::alloc::AllocError>(()) /// ``` - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn try_new_uninit_slice_in( len: usize, @@ -1113,7 +1108,7 @@ impl Box<[T], A> { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::alloc::System; /// @@ -1125,7 +1120,7 @@ impl Box<[T], A> { /// ``` /// /// [zeroed]: mem::MaybeUninit::zeroed - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn try_new_zeroed_slice_in( len: usize, @@ -1527,7 +1522,7 @@ impl Box { /// Recreate a `Box` which was previously converted to a raw pointer /// using [`Box::into_raw_with_allocator`]: /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::alloc::System; /// @@ -1537,7 +1532,7 @@ impl Box { /// ``` /// Manually create a `Box` from scratch by using the system allocator: /// ``` - /// #![feature(allocator_api, slice_ptr_get)] + /// #![feature(allocator_ext, slice_ptr_get)] /// /// use std::alloc::{Allocator, Layout, System}; /// @@ -1554,7 +1549,7 @@ impl Box { /// /// [memory layout]: self#memory-layout /// [considerations for unsafe code]: self#considerations-for-unsafe-code - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub unsafe fn from_raw_in(raw: *mut T, alloc: A) -> Self { Box(unsafe { Unique::new_unchecked(raw) }, alloc) @@ -1584,7 +1579,7 @@ impl Box { /// Recreate a `Box` which was previously converted to a `NonNull` pointer /// using [`Box::into_non_null_with_allocator`]: /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::alloc::System; /// @@ -1594,7 +1589,7 @@ impl Box { /// ``` /// Manually create a `Box` from scratch by using the system allocator: /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::alloc::{Allocator, Layout, System}; /// @@ -1610,7 +1605,7 @@ impl Box { /// /// [memory layout]: self#memory-layout /// [considerations for unsafe code]: self#considerations-for-unsafe-code - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub unsafe fn from_non_null_in(raw: NonNull, alloc: A) -> Self { // SAFETY: guaranteed by the caller. @@ -1637,7 +1632,7 @@ impl Box { /// Converting the raw pointer back into a `Box` with [`Box::from_raw_in`] /// for automatic cleanup: /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::alloc::System; /// @@ -1648,7 +1643,7 @@ impl Box { /// Manual cleanup by explicitly running the destructor and deallocating /// the memory: /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::alloc::{Allocator, Layout, System}; /// use std::ptr::{self, NonNull}; @@ -1664,7 +1659,7 @@ impl Box { /// /// [memory layout]: self#memory-layout #[must_use = "losing the pointer will leak memory"] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[rustc_const_unstable(feature = "const_heap", issue = "79597")] #[inline] pub const fn into_raw_with_allocator(b: Self) -> (*mut T, A) { @@ -1700,7 +1695,7 @@ impl Box { /// Converting the `NonNull` pointer back into a `Box` with /// [`Box::from_non_null_in`] for automatic cleanup: /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::alloc::System; /// @@ -1711,7 +1706,7 @@ impl Box { /// Manual cleanup by explicitly running the destructor and deallocating /// the memory: /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::alloc::{Allocator, Layout, System}; /// @@ -1725,7 +1720,7 @@ impl Box { /// /// [memory layout]: self#memory-layout #[must_use = "losing the pointer will leak memory"] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn into_non_null_with_allocator(b: Self) -> (NonNull, A) { let (ptr, alloc) = Box::into_raw_with_allocator(b); @@ -1883,7 +1878,7 @@ impl Box { /// Note: this is an associated function, which means that you have /// to call it as `Box::allocator(&b)` instead of `b.allocator()`. This /// is so that there is no conflict with a method on the inner type. - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn allocator(b: &Self) -> &A { &b.1 @@ -2481,7 +2476,7 @@ impl Future for Box { } #[stable(feature = "box_error", since = "1.8.0")] -impl Error for Box { +impl Error for Box { #[allow(deprecated)] fn cause(&self) -> Option<&dyn Error> { Error::cause(&**self) @@ -2496,7 +2491,7 @@ impl Error for Box { } } -#[unstable(feature = "allocator_api", issue = "32838")] +#[stable(feature = "allocator_api", since = "CURRENT_RUSTC_VERSION")] unsafe impl Allocator for Box { #[inline] fn allocate(&self, layout: Layout) -> Result, AllocError> { diff --git a/library/alloc/src/boxed/thin.rs b/library/alloc/src/boxed/thin.rs index 22c3d89e3ccdb..dd9442e6ca167 100644 --- a/library/alloc/src/boxed/thin.rs +++ b/library/alloc/src/boxed/thin.rs @@ -78,7 +78,6 @@ impl ThinBox { /// # Examples /// /// ``` - /// #![feature(allocator_api)] /// #![feature(thin_box)] /// use std::boxed::ThinBox; /// diff --git a/library/alloc/src/collections/binary_heap/mod.rs b/library/alloc/src/collections/binary_heap/mod.rs index 98192e1fb5b01..0825b6d67027f 100644 --- a/library/alloc/src/collections/binary_heap/mod.rs +++ b/library/alloc/src/collections/binary_heap/mod.rs @@ -273,7 +273,7 @@ use crate::vec::{self, Vec}; #[cfg_attr(not(test), rustc_diagnostic_item = "BinaryHeap")] pub struct BinaryHeap< T, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { data: Vec, } @@ -289,7 +289,7 @@ pub struct BinaryHeap< pub struct PeekMut< 'a, T: 'a + Ord, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { heap: &'a mut BinaryHeap, // If a set_len + sift_down are required, this is Some. If a &mut T has not @@ -484,7 +484,7 @@ impl fmt::Debug for BinaryHeap { struct RebuildOnDrop< 'a, T: Ord, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { heap: &'a mut BinaryHeap, rebuild_from: usize, @@ -545,14 +545,15 @@ impl BinaryHeap { /// Basic usage: /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::alloc::System; /// use std::collections::BinaryHeap; /// /// let heap : BinaryHeap = BinaryHeap::new_in(System); /// ``` - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] + #[rustc_const_unstable(feature = "allocator_ext", issue = "32838")] #[must_use] pub const fn new_in(alloc: A) -> BinaryHeap { BinaryHeap { data: Vec::new_in(alloc) } @@ -569,14 +570,14 @@ impl BinaryHeap { /// Basic usage: /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::alloc::System; /// use std::collections::BinaryHeap; /// /// let heap: BinaryHeap = BinaryHeap::with_capacity_in(10, System); /// ``` - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[must_use] pub fn with_capacity_in(capacity: usize, alloc: A) -> BinaryHeap { BinaryHeap { data: Vec::with_capacity_in(capacity, alloc) } @@ -1419,7 +1420,7 @@ impl BinaryHeap { } /// Returns a reference to the underlying allocator. - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn allocator(&self) -> &A { self.data.allocator() @@ -1679,14 +1680,14 @@ impl FusedIterator for Iter<'_, T> {} #[derive(Clone)] pub struct IntoIter< T, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { iter: vec::IntoIter, } impl IntoIter { /// Returns a reference to the underlying allocator. - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn allocator(&self) -> &A { self.iter.allocator() } @@ -1784,14 +1785,14 @@ unsafe impl AsVecIntoIter for IntoIter { #[derive(Clone, Debug)] pub struct IntoIterSorted< T, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { inner: BinaryHeap, } impl IntoIterSorted { /// Returns a reference to the underlying allocator. - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn allocator(&self) -> &A { self.inner.allocator() } @@ -1833,14 +1834,14 @@ unsafe impl TrustedLen for IntoIterSorted {} pub struct Drain< 'a, T: 'a, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { iter: vec::Drain<'a, T, A>, } impl Drain<'_, T, A> { /// Returns a reference to the underlying allocator. - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn allocator(&self) -> &A { self.iter.allocator() } @@ -1890,14 +1891,14 @@ impl FusedIterator for Drain<'_, T, A> {} pub struct DrainSorted< 'a, T: Ord, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { inner: &'a mut BinaryHeap, } impl<'a, T: Ord, A: Allocator> DrainSorted<'a, T, A> { /// Returns a reference to the underlying allocator. - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn allocator(&self) -> &A { self.inner.allocator() } diff --git a/library/alloc/src/collections/btree/map.rs b/library/alloc/src/collections/btree/map.rs index 0a1f7738632c1..1abc103875d86 100644 --- a/library/alloc/src/collections/btree/map.rs +++ b/library/alloc/src/collections/btree/map.rs @@ -189,7 +189,7 @@ pub(super) const MIN_LEN: usize = node::MIN_LEN_AFTER_SPLIT; pub struct BTreeMap< K, V, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + Clone = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator + Clone = Global, > { root: Option>, length: usize, @@ -444,7 +444,7 @@ impl<'a, K: 'a, V: 'a> Default for IterMut<'a, K, V> { pub struct IntoIter< K, V, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + Clone = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator + Clone = Global, > { range: LazyLeafRange, length: usize, @@ -552,7 +552,7 @@ impl fmt::Debug for ValuesMut<'_, K, V> { pub struct IntoKeys< K, V, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + Clone = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator + Clone = Global, > { inner: IntoIter, } @@ -575,7 +575,7 @@ impl fmt::Debug for IntoKeys { pub struct IntoValues< K, V, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + Clone = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator + Clone = Global, > { inner: IntoIter, } @@ -682,7 +682,6 @@ impl BTreeMap { /// # Examples /// /// ``` - /// # #![feature(allocator_api)] /// # #![feature(btreemap_alloc)] /// /// use std::collections::BTreeMap; @@ -2133,7 +2132,7 @@ pub struct ExtractIf< V, R, F, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + Clone = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator + Clone = Global, > { pred: F, inner: ExtractIfInner<'a, K, V, R>, @@ -3144,7 +3143,7 @@ pub struct CursorMut< 'a, K: 'a, V: 'a, - #[unstable(feature = "allocator_api", issue = "32838")] A = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A = Global, > { inner: CursorMutKey<'a, K, V, A>, } @@ -3182,7 +3181,7 @@ pub struct CursorMutKey< 'a, K: 'a, V: 'a, - #[unstable(feature = "allocator_api", issue = "32838")] A = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A = Global, > { // If current is None then it means the tree has not been allocated yet. current: Option, K, V, marker::Leaf>, marker::Edge>>, diff --git a/library/alloc/src/collections/btree/map/entry.rs b/library/alloc/src/collections/btree/map/entry.rs index 1c2ad5c568e6a..0c730e8509dfb 100644 --- a/library/alloc/src/collections/btree/map/entry.rs +++ b/library/alloc/src/collections/btree/map/entry.rs @@ -20,7 +20,7 @@ pub enum Entry< 'a, K: 'a, V: 'a, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + Clone = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator + Clone = Global, > { /// A vacant entry. #[stable(feature = "rust1", since = "1.0.0")] @@ -48,7 +48,7 @@ pub struct VacantEntry< 'a, K, V, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + Clone = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator + Clone = Global, > { pub(super) key: K, /// `None` for a (empty) map without root @@ -76,7 +76,7 @@ pub struct OccupiedEntry< 'a, K, V, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + Clone = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator + Clone = Global, > { pub(super) handle: Handle, K, V, marker::LeafOrInternal>, marker::KV>, pub(super) dormant_map: DormantMutRef<'a, BTreeMap>, @@ -104,7 +104,7 @@ pub struct OccupiedError< 'a, K: 'a, V: 'a, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + Clone = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator + Clone = Global, > { /// The entry in the map that was already occupied. pub entry: OccupiedEntry<'a, K, V, A>, diff --git a/library/alloc/src/collections/btree/set.rs b/library/alloc/src/collections/btree/set.rs index 2a483b3d3982e..8926328168ce8 100644 --- a/library/alloc/src/collections/btree/set.rs +++ b/library/alloc/src/collections/btree/set.rs @@ -77,7 +77,7 @@ pub use self::entry::{Entry, OccupiedEntry, VacantEntry}; #[cfg_attr(not(test), rustc_diagnostic_item = "BTreeSet")] pub struct BTreeSet< T, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + Clone = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator + Clone = Global, > { map: BTreeMap, } @@ -153,7 +153,7 @@ impl fmt::Debug for Iter<'_, T> { #[derive(Debug)] pub struct IntoIter< T, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + Clone = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator + Clone = Global, > { iter: super::map::IntoIter, } @@ -183,7 +183,7 @@ pub struct Range<'a, T: 'a> { pub struct Difference< 'a, T: 'a, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + Clone = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator + Clone = Global, > { inner: DifferenceInner<'a, T, A>, } @@ -257,7 +257,7 @@ impl fmt::Debug for SymmetricDifference<'_, T> { pub struct Intersection< 'a, T: 'a, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + Clone = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator + Clone = Global, > { inner: IntersectionInner<'a, T, A>, } @@ -353,7 +353,6 @@ impl BTreeSet { /// /// ``` /// # #![allow(unused_mut)] - /// # #![feature(allocator_api)] /// # #![feature(btreemap_alloc)] /// /// use std::collections::BTreeSet; @@ -1559,7 +1558,7 @@ pub struct ExtractIf< T, R, F, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + Clone = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator + Clone = Global, > { pred: F, inner: super::map::ExtractIfInner<'a, T, SetValZST, R>, @@ -2156,8 +2155,11 @@ impl Debug for Cursor<'_, K> { /// A `CursorMut` is created with the [`BTreeSet::lower_bound_mut`] and [`BTreeSet::upper_bound_mut`] /// methods. #[unstable(feature = "btree_cursors", issue = "107540")] -pub struct CursorMut<'a, K: 'a, #[unstable(feature = "allocator_api", issue = "32838")] A = Global> -{ +pub struct CursorMut< + 'a, + K: 'a, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A = Global, +> { inner: super::map::CursorMut<'a, K, SetValZST, A>, } @@ -2193,7 +2195,7 @@ impl Debug for CursorMut<'_, K, A> { pub struct CursorMutKey< 'a, K: 'a, - #[unstable(feature = "allocator_api", issue = "32838")] A = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A = Global, > { inner: super::map::CursorMutKey<'a, K, SetValZST, A>, } diff --git a/library/alloc/src/collections/btree/set/entry.rs b/library/alloc/src/collections/btree/set/entry.rs index a60d22f9ece71..e734490ec9494 100644 --- a/library/alloc/src/collections/btree/set/entry.rs +++ b/library/alloc/src/collections/btree/set/entry.rs @@ -42,7 +42,7 @@ use crate::alloc::{Allocator, Global}; pub enum Entry< 'a, T, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + Clone = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator + Clone = Global, > { /// An occupied entry. /// @@ -133,7 +133,7 @@ impl Debug for Entry<'_, T, A> { pub struct OccupiedEntry< 'a, T, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + Clone = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator + Clone = Global, > { pub(super) inner: map::OccupiedEntry<'a, T, SetValZST, A>, } @@ -175,7 +175,7 @@ impl Debug for OccupiedEntry<'_, T, A> { pub struct VacantEntry< 'a, T, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + Clone = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator + Clone = Global, > { pub(super) inner: map::VacantEntry<'a, T, SetValZST, A>, } diff --git a/library/alloc/src/collections/linked_list.rs b/library/alloc/src/collections/linked_list.rs index 788609f740d07..c6ff2180bd7d8 100644 --- a/library/alloc/src/collections/linked_list.rs +++ b/library/alloc/src/collections/linked_list.rs @@ -50,7 +50,7 @@ mod tests; #[rustc_insignificant_dtor] pub struct LinkedList< T, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { head: Option>>, tail: Option>>, @@ -141,7 +141,7 @@ impl fmt::Debug for IterMut<'_, T> { #[stable(feature = "rust1", since = "1.0.0")] pub struct IntoIter< T, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { list: LinkedList, } @@ -505,7 +505,7 @@ impl LinkedList { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::alloc::System; /// use std::collections::LinkedList; @@ -513,7 +513,7 @@ impl LinkedList { /// let list: LinkedList = LinkedList::new_in(System); /// ``` #[inline] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub const fn new_in(alloc: A) -> Self { LinkedList { head: None, tail: None, len: 0, alloc, marker: PhantomData } } @@ -1336,7 +1336,7 @@ impl Default for IterMut<'_, T> { pub struct Cursor< 'a, T: 'a, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { index: usize, current: Option>>, @@ -1372,7 +1372,7 @@ impl fmt::Debug for Cursor<'_, T, A> { pub struct CursorMut< 'a, T: 'a, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { index: usize, current: Option>>, @@ -1953,7 +1953,7 @@ pub struct ExtractIf< 'a, T: 'a, F: 'a, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { list: &'a mut LinkedList, it: Option>>, diff --git a/library/alloc/src/collections/vec_deque/drain.rs b/library/alloc/src/collections/vec_deque/drain.rs index da4b803c64d56..766a833684b7d 100644 --- a/library/alloc/src/collections/vec_deque/drain.rs +++ b/library/alloc/src/collections/vec_deque/drain.rs @@ -18,7 +18,7 @@ use crate::alloc::{Allocator, Global}; pub struct Drain< 'a, T: 'a, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { // We can't just use a &mut VecDeque, as that would make Drain invariant over T // and we want it to be covariant instead diff --git a/library/alloc/src/collections/vec_deque/extract_if.rs b/library/alloc/src/collections/vec_deque/extract_if.rs index 19439dfb4f05d..e9ac8e6fae0fa 100644 --- a/library/alloc/src/collections/vec_deque/extract_if.rs +++ b/library/alloc/src/collections/vec_deque/extract_if.rs @@ -27,7 +27,7 @@ pub struct ExtractIf< 'a, T, F, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { vec: &'a mut VecDeque, /// The index of the item that will be inspected by the next call to `next`. @@ -57,7 +57,7 @@ impl<'a, T, F, A: Allocator> ExtractIf<'a, T, F, A> { } /// Returns a reference to the underlying allocator. - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn allocator(&self) -> &A { self.vec.allocator() diff --git a/library/alloc/src/collections/vec_deque/into_iter.rs b/library/alloc/src/collections/vec_deque/into_iter.rs index e18b85dd4b694..104d4ed98d5a5 100644 --- a/library/alloc/src/collections/vec_deque/into_iter.rs +++ b/library/alloc/src/collections/vec_deque/into_iter.rs @@ -18,7 +18,7 @@ use crate::alloc::{Allocator, Global}; #[stable(feature = "rust1", since = "1.0.0")] pub struct IntoIter< T, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { inner: VecDeque, } diff --git a/library/alloc/src/collections/vec_deque/mod.rs b/library/alloc/src/collections/vec_deque/mod.rs index 940fce7377938..616754e252df4 100644 --- a/library/alloc/src/collections/vec_deque/mod.rs +++ b/library/alloc/src/collections/vec_deque/mod.rs @@ -103,7 +103,7 @@ mod tests; #[rustc_insignificant_dtor] pub struct VecDeque< T, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { // `self[0]`, if it exists, is `buf[head]`. // `head < buf.capacity()`, unless `buf.capacity() == 0` when `head == 0`. @@ -879,7 +879,7 @@ impl VecDeque { /// # Examples /// /// ``` - /// # #![feature(allocator_api)] + /// # #![feature(allocator_ext)] /// /// use std::collections::VecDeque; /// use std::alloc::Global; @@ -887,7 +887,7 @@ impl VecDeque { /// let deque: VecDeque = VecDeque::new_in(Global); /// ``` #[inline] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub const fn new_in(alloc: A) -> VecDeque { VecDeque { head: WrappedIndex::zero(), len: 0, buf: RawVec::new_in(alloc) } } @@ -897,14 +897,14 @@ impl VecDeque { /// # Examples /// /// ``` - /// # #![feature(allocator_api)] + /// # #![feature(allocator_ext)] /// /// use std::collections::VecDeque; /// use std::alloc::Global; /// /// let deque: VecDeque = VecDeque::with_capacity_in(10, Global); /// ``` - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn with_capacity_in(capacity: usize, alloc: A) -> VecDeque { VecDeque { head: WrappedIndex::zero(), @@ -1606,7 +1606,7 @@ impl VecDeque { } /// Returns a reference to the underlying allocator. - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn allocator(&self) -> &A { self.buf.allocator() diff --git a/library/alloc/src/collections/vec_deque/splice.rs b/library/alloc/src/collections/vec_deque/splice.rs index a29e9c3742564..bdf6a9fc68b45 100644 --- a/library/alloc/src/collections/vec_deque/splice.rs +++ b/library/alloc/src/collections/vec_deque/splice.rs @@ -24,7 +24,7 @@ use crate::vec::Vec; pub struct Splice< 'a, I: Iterator + 'a, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + 'a = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator + 'a = Global, > { pub(super) drain: Drain<'a, I::Item, A>, pub(super) replace_with: I, diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index 5cf05071bc329..e395370ada945 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -89,7 +89,7 @@ // // Library features: // tidy-alphabetical-start -#![feature(allocator_api)] +#![feature(allocator_ext)] #![feature(array_into_iter_constructors)] #![feature(ascii_char)] #![feature(async_fn_traits)] diff --git a/library/alloc/src/rc.rs b/library/alloc/src/rc.rs index e639a32370703..0537e51e1efbb 100644 --- a/library/alloc/src/rc.rs +++ b/library/alloc/src/rc.rs @@ -323,7 +323,7 @@ fn rc_inner_layout_for_value_layout(layout: Layout) -> Layout { pub struct Rc< T: ?Sized, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { ptr: NonNull>, phantom: PhantomData>, @@ -558,13 +558,13 @@ impl Rc { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// use std::rc::Rc; /// /// let five = Rc::try_new(5); /// # Ok::<(), std::alloc::AllocError>(()) /// ``` - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn try_new(value: T) -> Result, AllocError> { // There is an implicit weak pointer owned by all the strong // pointers, which ensures that the weak destructor never frees @@ -587,7 +587,7 @@ impl Rc { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::rc::Rc; /// @@ -601,7 +601,7 @@ impl Rc { /// assert_eq!(*five, 5); /// # Ok::<(), std::alloc::AllocError>(()) /// ``` - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn try_new_uninit() -> Result>, AllocError> { unsafe { Ok(Rc::from_ptr(Rc::try_allocate_for_layout( @@ -621,7 +621,7 @@ impl Rc { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::rc::Rc; /// @@ -633,7 +633,7 @@ impl Rc { /// ``` /// /// [zeroed]: mem::MaybeUninit::zeroed - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn try_new_zeroed() -> Result>, AllocError> { unsafe { Ok(Rc::from_ptr(Rc::try_allocate_for_layout( @@ -746,7 +746,7 @@ impl Rc { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::rc::Rc; /// use std::alloc::System; @@ -754,7 +754,7 @@ impl Rc { /// let five = Rc::new_in(5, System); /// ``` #[cfg(not(no_global_oom_handling))] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn new_in(value: T, alloc: A) -> Rc { // NOTE: Prefer match over unwrap_or_else since closure sometimes not inlineable. @@ -771,7 +771,7 @@ impl Rc { /// /// ``` /// #![feature(get_mut_unchecked)] - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::rc::Rc; /// use std::alloc::System; @@ -788,7 +788,7 @@ impl Rc { /// assert_eq!(*five, 5) /// ``` #[cfg(not(no_global_oom_handling))] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn new_uninit_in(alloc: A) -> Rc, A> { unsafe { @@ -812,7 +812,7 @@ impl Rc { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::rc::Rc; /// use std::alloc::System; @@ -825,7 +825,7 @@ impl Rc { /// /// [zeroed]: mem::MaybeUninit::zeroed #[cfg(not(no_global_oom_handling))] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn new_zeroed_in(alloc: A) -> Rc, A> { unsafe { @@ -870,7 +870,7 @@ impl Rc { /// [`new_cyclic`]: Rc::new_cyclic /// [`upgrade`]: Weak::upgrade #[cfg(not(no_global_oom_handling))] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn new_cyclic_in(data_fn: F, alloc: A) -> Rc where F: FnOnce(&Weak) -> T, @@ -922,14 +922,14 @@ impl Rc { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// use std::rc::Rc; /// use std::alloc::System; /// /// let five = Rc::try_new_in(5, System); /// # Ok::<(), std::alloc::AllocError>(()) /// ``` - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn try_new_in(value: T, alloc: A) -> Result { // There is an implicit weak pointer owned by all the strong @@ -949,7 +949,7 @@ impl Rc { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// #![feature(get_mut_unchecked)] /// /// use std::rc::Rc; @@ -967,7 +967,7 @@ impl Rc { /// assert_eq!(*five, 5); /// # Ok::<(), std::alloc::AllocError>(()) /// ``` - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn try_new_uninit_in(alloc: A) -> Result, A>, AllocError> { unsafe { @@ -992,7 +992,7 @@ impl Rc { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::rc::Rc; /// use std::alloc::System; @@ -1005,7 +1005,7 @@ impl Rc { /// ``` /// /// [zeroed]: mem::MaybeUninit::zeroed - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn try_new_zeroed_in(alloc: A) -> Result, A>, AllocError> { unsafe { @@ -1023,7 +1023,7 @@ impl Rc { /// Constructs a new `Pin>` in the provided allocator. If `T` does not implement `Unpin`, then /// `value` will be pinned in memory and unable to be moved. #[cfg(not(no_global_oom_handling))] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn pin_in(value: T, alloc: A) -> Pin where @@ -1175,7 +1175,7 @@ impl Rc<[T], A> { /// /// ``` /// #![feature(get_mut_unchecked)] - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::rc::Rc; /// use std::alloc::System; @@ -1194,7 +1194,7 @@ impl Rc<[T], A> { /// assert_eq!(*values, [1, 2, 3]) /// ``` #[cfg(not(no_global_oom_handling))] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn new_uninit_slice_in(len: usize, alloc: A) -> Rc<[mem::MaybeUninit], A> { unsafe { Rc::from_ptr_in(Rc::allocate_for_slice_in(len, &alloc), alloc) } @@ -1209,7 +1209,7 @@ impl Rc<[T], A> { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::rc::Rc; /// use std::alloc::System; @@ -1222,7 +1222,7 @@ impl Rc<[T], A> { /// /// [zeroed]: mem::MaybeUninit::zeroed #[cfg(not(no_global_oom_handling))] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn new_zeroed_slice_in(len: usize, alloc: A) -> Rc<[mem::MaybeUninit], A> { unsafe { @@ -1330,14 +1330,13 @@ impl Rc { /// /// ``` /// #![feature(clone_from_ref)] - /// #![feature(allocator_api)] /// use std::rc::Rc; /// /// let hello: Rc = Rc::try_clone_from_ref("hello")?; /// # Ok::<(), std::alloc::AllocError>(()) /// ``` #[unstable(feature = "clone_from_ref", issue = "149075")] - //#[unstable(feature = "allocator_api", issue = "32838")] + //#[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn try_clone_from_ref(value: &T) -> Result, AllocError> { Rc::try_clone_from_ref_in(value, Global) } @@ -1350,7 +1349,7 @@ impl Rc { /// /// ``` /// #![feature(clone_from_ref)] - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// use std::rc::Rc; /// use std::alloc::System; /// @@ -1358,7 +1357,7 @@ impl Rc { /// ``` #[cfg(not(no_global_oom_handling))] #[unstable(feature = "clone_from_ref", issue = "149075")] - //#[unstable(feature = "allocator_api", issue = "32838")] + //#[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn clone_from_ref_in(value: &T, alloc: A) -> Rc { // `in_progress` drops the allocation if we panic before finishing initializing it. let mut in_progress: UniqueRcUninit = UniqueRcUninit::new(value, alloc); @@ -1378,7 +1377,7 @@ impl Rc { /// /// ``` /// #![feature(clone_from_ref)] - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// use std::rc::Rc; /// use std::alloc::System; /// @@ -1386,7 +1385,7 @@ impl Rc { /// # Ok::<(), std::alloc::AllocError>(()) /// ``` #[unstable(feature = "clone_from_ref", issue = "149075")] - //#[unstable(feature = "allocator_api", issue = "32838")] + //#[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn try_clone_from_ref_in(value: &T, alloc: A) -> Result, AllocError> { // `in_progress` drops the allocation if we panic before finishing initializing it. let mut in_progress: UniqueRcUninit = UniqueRcUninit::try_new(value, alloc)?; @@ -1615,7 +1614,7 @@ impl Rc { /// to call it as `Rc::allocator(&r)` instead of `r.allocator()`. This /// is so that there is no conflict with a method on the inner type. #[inline] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn allocator(this: &Self) -> &A { &this.alloc } @@ -1628,7 +1627,7 @@ impl Rc { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// use std::rc::Rc; /// use std::alloc::System; /// @@ -1639,7 +1638,7 @@ impl Rc { /// assert_eq!(&*x, "hello"); /// ``` #[must_use = "losing the pointer will leak memory"] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn into_raw_with_allocator(this: Self) -> (*const T, A) { let this = mem::ManuallyDrop::new(this); let ptr = Self::as_ptr(&this); @@ -1710,7 +1709,7 @@ impl Rc { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::rc::Rc; /// use std::alloc::System; @@ -1732,7 +1731,7 @@ impl Rc { /// Convert a slice back into its original array: /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::rc::Rc; /// use std::alloc::System; @@ -1745,7 +1744,7 @@ impl Rc { /// assert_eq!(&*x, &[1, 2, 3]); /// } /// ``` - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub unsafe fn from_raw_in(ptr: *const T, alloc: A) -> Self { let offset = unsafe { data_offset(ptr) }; @@ -1831,7 +1830,7 @@ impl Rc { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::rc::Rc; /// use std::alloc::System; @@ -1849,7 +1848,7 @@ impl Rc { /// } /// ``` #[inline] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub unsafe fn increment_strong_count_in(ptr: *const T, alloc: A) where A: AllocatorClone, @@ -1877,7 +1876,7 @@ impl Rc { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::rc::Rc; /// use std::alloc::System; @@ -1895,7 +1894,7 @@ impl Rc { /// } /// ``` #[inline] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub unsafe fn decrement_strong_count_in(ptr: *const T, alloc: A) { unsafe { drop(Rc::from_raw_in(ptr, alloc)) }; } @@ -2983,7 +2982,7 @@ impl From for Rc { #[cfg(not(no_global_oom_handling))] #[stable(feature = "shared_from_slice", since = "1.21.0")] -impl From> for Rc { +impl From> for Rc { /// Move a boxed object to a new, reference counted, allocation. /// /// # Example @@ -2995,7 +2994,7 @@ impl From> for Rc { /// assert_eq!(1, *shared); /// ``` #[inline] - fn from(v: Box) -> Rc { + fn from(v: Box) -> Rc { Rc::from_box_in(v) } } @@ -3202,7 +3201,7 @@ impl> ToRcSlice for I { #[rustc_diagnostic_item = "RcWeak"] pub struct Weak< T: ?Sized, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { // This is a `NonNull` to allow optimizing the size of this type in enums, // but it is not necessarily a valid pointer. @@ -3267,7 +3266,7 @@ impl Weak { /// assert!(empty.upgrade().is_none()); /// ``` #[inline] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn new_in(alloc: A) -> Weak { Weak { ptr: NonNull::without_provenance(NonZeroUsize::MAX), alloc } } @@ -3370,7 +3369,7 @@ impl Weak { impl Weak { /// Returns a reference to the underlying allocator. #[inline] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn allocator(&self) -> &A { &self.alloc } @@ -3429,7 +3428,7 @@ impl Weak { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// use std::rc::{Rc, Weak}; /// use std::alloc::System; /// @@ -3448,7 +3447,7 @@ impl Weak { /// [`as_ptr`]: Weak::as_ptr #[must_use = "losing the pointer will leak memory"] #[inline] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn into_raw_with_allocator(self) -> (*const T, A) { let this = mem::ManuallyDrop::new(self); let result = this.as_ptr(); @@ -3500,7 +3499,7 @@ impl Weak { /// [`upgrade`]: Weak::upgrade /// [`new`]: Weak::new #[inline] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub unsafe fn from_raw_in(ptr: *const T, alloc: A) -> Self { // See Weak::as_ptr for context on how the input pointer is derived. @@ -3933,7 +3932,7 @@ fn data_offset_alignment(alignment: Alignment) -> usize { #[unstable(feature = "unique_rc_arc", issue = "112566")] pub struct UniqueRc< T: ?Sized, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { ptr: NonNull>, // Define the ownership of `RcInner` for drop-check @@ -4559,7 +4558,7 @@ impl Drop for UniqueRcUninit { } } -#[unstable(feature = "allocator_api", issue = "32838")] +#[stable(feature = "allocator_api", since = "CURRENT_RUSTC_VERSION")] unsafe impl Allocator for Rc { #[inline] fn allocate(&self, layout: Layout) -> Result, AllocError> { @@ -4611,5 +4610,5 @@ unsafe impl Allocator for Rc { } } -#[unstable(feature = "allocator_api", issue = "32838")] +#[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] unsafe impl AllocatorClone for Rc {} diff --git a/library/alloc/src/slice.rs b/library/alloc/src/slice.rs index e6b540f093ba5..6c8a4b97a524c 100644 --- a/library/alloc/src/slice.rs +++ b/library/alloc/src/slice.rs @@ -381,7 +381,7 @@ impl [T] { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::alloc::System; /// @@ -392,7 +392,7 @@ impl [T] { #[cfg(not(no_global_oom_handling))] #[rustc_allow_incoherent_impl] #[inline] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn to_vec_in(&self, alloc: A) -> Vec where T: Clone, diff --git a/library/alloc/src/sync.rs b/library/alloc/src/sync.rs index 5ea0fd3a394d4..0b13be41f016c 100644 --- a/library/alloc/src/sync.rs +++ b/library/alloc/src/sync.rs @@ -273,7 +273,7 @@ macro_rules! acquire { )] pub struct Arc< T: ?Sized, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { ptr: NonNull>, phantom: PhantomData>, @@ -352,7 +352,7 @@ impl Arc { #[rustc_diagnostic_item = "ArcWeak"] pub struct Weak< T: ?Sized, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { // This is a `NonNull` to allow optimizing the size of this type in enums, // but it is not necessarily a valid pointer. @@ -578,7 +578,7 @@ impl Arc { } /// Constructs a new `Pin>`, return an error if allocation fails. - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn try_pin(data: T) -> Result>, AllocError> { unsafe { Ok(Pin::new_unchecked(Arc::try_new(data)?)) } @@ -589,13 +589,13 @@ impl Arc { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// use std::sync::Arc; /// /// let five = Arc::try_new(5)?; /// # Ok::<(), std::alloc::AllocError>(()) /// ``` - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn try_new(data: T) -> Result, AllocError> { // Start the weak pointer count as 1 which is the weak pointer that's @@ -614,7 +614,7 @@ impl Arc { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::sync::Arc; /// @@ -628,7 +628,7 @@ impl Arc { /// assert_eq!(*five, 5); /// # Ok::<(), std::alloc::AllocError>(()) /// ``` - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn try_new_uninit() -> Result>, AllocError> { unsafe { Ok(Arc::from_ptr(Arc::try_allocate_for_layout( @@ -648,7 +648,7 @@ impl Arc { /// # Examples /// /// ``` - /// #![feature( allocator_api)] + /// #![feature( allocator_ext)] /// /// use std::sync::Arc; /// @@ -660,7 +660,7 @@ impl Arc { /// ``` /// /// [zeroed]: mem::MaybeUninit::zeroed - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn try_new_zeroed() -> Result>, AllocError> { unsafe { Ok(Arc::from_ptr(Arc::try_allocate_for_layout( @@ -765,7 +765,7 @@ impl Arc { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::sync::Arc; /// use std::alloc::System; @@ -774,7 +774,7 @@ impl Arc { /// ``` #[inline] #[cfg(not(no_global_oom_handling))] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn new_in(data: T, alloc: A) -> Arc { // Start the weak pointer count as 1 which is the weak pointer that's // held by all the strong pointers (kinda), see std/rc.rs for more info @@ -796,7 +796,7 @@ impl Arc { /// /// ``` /// #![feature(get_mut_unchecked)] - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::sync::Arc; /// use std::alloc::System; @@ -813,7 +813,7 @@ impl Arc { /// assert_eq!(*five, 5) /// ``` #[cfg(not(no_global_oom_handling))] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn new_uninit_in(alloc: A) -> Arc, A> { unsafe { @@ -837,7 +837,7 @@ impl Arc { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::sync::Arc; /// use std::alloc::System; @@ -850,7 +850,7 @@ impl Arc { /// /// [zeroed]: mem::MaybeUninit::zeroed #[cfg(not(no_global_oom_handling))] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn new_zeroed_in(alloc: A) -> Arc, A> { unsafe { @@ -896,7 +896,7 @@ impl Arc { /// [`upgrade`]: Weak::upgrade #[cfg(not(no_global_oom_handling))] #[inline] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn new_cyclic_in(data_fn: F, alloc: A) -> Arc where F: FnOnce(&Weak) -> T, @@ -958,7 +958,7 @@ impl Arc { /// Constructs a new `Pin>` in the provided allocator. If `T` does not implement `Unpin`, /// then `data` will be pinned in memory and unable to be moved. #[cfg(not(no_global_oom_handling))] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn pin_in(data: T, alloc: A) -> Pin> where @@ -970,7 +970,7 @@ impl Arc { /// Constructs a new `Pin>` in the provided allocator, return an error if allocation /// fails. #[inline] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn try_pin_in(data: T, alloc: A) -> Result>, AllocError> where A: 'static, @@ -983,7 +983,7 @@ impl Arc { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::sync::Arc; /// use std::alloc::System; @@ -991,7 +991,7 @@ impl Arc { /// let five = Arc::try_new_in(5, System)?; /// # Ok::<(), std::alloc::AllocError>(()) /// ``` - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn try_new_in(data: T, alloc: A) -> Result, AllocError> { // Start the weak pointer count as 1 which is the weak pointer that's @@ -1014,7 +1014,7 @@ impl Arc { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// #![feature(get_mut_unchecked)] /// /// use std::sync::Arc; @@ -1032,7 +1032,7 @@ impl Arc { /// assert_eq!(*five, 5); /// # Ok::<(), std::alloc::AllocError>(()) /// ``` - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn try_new_uninit_in(alloc: A) -> Result, A>, AllocError> { unsafe { @@ -1057,7 +1057,7 @@ impl Arc { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::sync::Arc; /// use std::alloc::System; @@ -1070,7 +1070,7 @@ impl Arc { /// ``` /// /// [zeroed]: mem::MaybeUninit::zeroed - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn try_new_zeroed_in(alloc: A) -> Result, A>, AllocError> { unsafe { @@ -1331,7 +1331,7 @@ impl Arc<[T], A> { /// /// ``` /// #![feature(get_mut_unchecked)] - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::sync::Arc; /// use std::alloc::System; @@ -1350,7 +1350,7 @@ impl Arc<[T], A> { /// assert_eq!(*values, [1, 2, 3]) /// ``` #[cfg(not(no_global_oom_handling))] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn new_uninit_slice_in(len: usize, alloc: A) -> Arc<[mem::MaybeUninit], A> { unsafe { Arc::from_ptr_in(Arc::allocate_for_slice_in(len, &alloc), alloc) } @@ -1365,7 +1365,7 @@ impl Arc<[T], A> { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::sync::Arc; /// use std::alloc::System; @@ -1378,7 +1378,7 @@ impl Arc<[T], A> { /// /// [zeroed]: mem::MaybeUninit::zeroed #[cfg(not(no_global_oom_handling))] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn new_zeroed_slice_in(len: usize, alloc: A) -> Arc<[mem::MaybeUninit], A> { unsafe { @@ -1487,14 +1487,13 @@ impl Arc { /// /// ``` /// #![feature(clone_from_ref)] - /// #![feature(allocator_api)] /// use std::sync::Arc; /// /// let hello: Arc = Arc::try_clone_from_ref("hello")?; /// # Ok::<(), std::alloc::AllocError>(()) /// ``` #[unstable(feature = "clone_from_ref", issue = "149075")] - //#[unstable(feature = "allocator_api", issue = "32838")] + //#[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn try_clone_from_ref(value: &T) -> Result, AllocError> { Arc::try_clone_from_ref_in(value, Global) } @@ -1507,7 +1506,7 @@ impl Arc { /// /// ``` /// #![feature(clone_from_ref)] - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// use std::sync::Arc; /// use std::alloc::System; /// @@ -1515,7 +1514,7 @@ impl Arc { /// ``` #[cfg(not(no_global_oom_handling))] #[unstable(feature = "clone_from_ref", issue = "149075")] - //#[unstable(feature = "allocator_api", issue = "32838")] + //#[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn clone_from_ref_in(value: &T, alloc: A) -> Arc { // `in_progress` drops the allocation if we panic before finishing initializing it. let mut in_progress: UniqueArcUninit = UniqueArcUninit::new(value, alloc); @@ -1535,7 +1534,7 @@ impl Arc { /// /// ``` /// #![feature(clone_from_ref)] - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// use std::sync::Arc; /// use std::alloc::System; /// @@ -1543,7 +1542,7 @@ impl Arc { /// # Ok::<(), std::alloc::AllocError>(()) /// ``` #[unstable(feature = "clone_from_ref", issue = "149075")] - //#[unstable(feature = "allocator_api", issue = "32838")] + //#[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn try_clone_from_ref_in(value: &T, alloc: A) -> Result, AllocError> { // `in_progress` drops the allocation if we panic before finishing initializing it. let mut in_progress: UniqueArcUninit = UniqueArcUninit::try_new(value, alloc)?; @@ -1780,7 +1779,7 @@ impl Arc { /// to call it as `Arc::allocator(&a)` instead of `a.allocator()`. This /// is so that there is no conflict with a method on the inner type. #[inline] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn allocator(this: &Self) -> &A { &this.alloc } @@ -1793,7 +1792,7 @@ impl Arc { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// use std::sync::Arc; /// use std::alloc::System; /// @@ -1804,7 +1803,7 @@ impl Arc { /// assert_eq!(&*x, "hello"); /// ``` #[must_use = "losing the pointer will leak memory"] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn into_raw_with_allocator(this: Self) -> (*const T, A) { let this = mem::ManuallyDrop::new(this); let ptr = Self::as_ptr(&this); @@ -1876,7 +1875,7 @@ impl Arc { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::sync::Arc; /// use std::alloc::System; @@ -1898,7 +1897,7 @@ impl Arc { /// Convert a slice back into its original array: /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::sync::Arc; /// use std::alloc::System; @@ -1912,7 +1911,7 @@ impl Arc { /// } /// ``` #[inline] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub unsafe fn from_raw_in(ptr: *const T, alloc: A) -> Self { unsafe { let offset = data_offset(ptr); @@ -2049,7 +2048,7 @@ impl Arc { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::sync::Arc; /// use std::alloc::System; @@ -2069,7 +2068,7 @@ impl Arc { /// } /// ``` #[inline] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub unsafe fn increment_strong_count_in(ptr: *const T, alloc: A) where A: AllocatorClone, @@ -2098,7 +2097,7 @@ impl Arc { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::sync::Arc; /// use std::alloc::System; @@ -2118,7 +2117,7 @@ impl Arc { /// } /// ``` #[inline] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub unsafe fn decrement_strong_count_in(ptr: *const T, alloc: A) { unsafe { drop(Arc::from_raw_in(ptr, alloc)) }; } @@ -3020,7 +3019,7 @@ impl Weak { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::sync::Weak; /// use std::alloc::System; @@ -3029,7 +3028,7 @@ impl Weak { /// assert!(empty.upgrade().is_none()); /// ``` #[inline] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn new_in(alloc: A) -> Weak { Weak { ptr: NonNull::without_provenance(NonZeroUsize::MAX), alloc } } @@ -3127,7 +3126,7 @@ impl Weak { impl Weak { /// Returns a reference to the underlying allocator. #[inline] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn allocator(&self) -> &A { &self.alloc } @@ -3186,7 +3185,7 @@ impl Weak { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// use std::sync::{Arc, Weak}; /// use std::alloc::System; /// @@ -3204,7 +3203,7 @@ impl Weak { /// [`from_raw_in`]: Weak::from_raw_in /// [`as_ptr`]: Weak::as_ptr #[must_use = "losing the pointer will leak memory"] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn into_raw_with_allocator(self) -> (*const T, A) { let this = mem::ManuallyDrop::new(self); let result = this.as_ptr(); @@ -3256,7 +3255,7 @@ impl Weak { /// [`into_raw`]: Weak::into_raw /// [`upgrade`]: Weak::upgrade #[inline] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub unsafe fn from_raw_in(ptr: *const T, alloc: A) -> Self { // See Weak::as_ptr for context on how the input pointer is derived. @@ -4050,7 +4049,7 @@ impl From for Arc { #[cfg(not(no_global_oom_handling))] #[stable(feature = "shared_from_slice", since = "1.21.0")] -impl From> for Arc { +impl From> for Arc { /// Move a boxed object to a new, reference-counted allocation. /// /// # Example @@ -4062,7 +4061,7 @@ impl From> for Arc { /// assert_eq!("eggplant", &shared[..]); /// ``` #[inline] - fn from(v: Box) -> Arc { + fn from(v: Box) -> Arc { Arc::from_box_in(v) } } @@ -4411,7 +4410,7 @@ impl core::error::Error for Arc { #[unstable(feature = "unique_rc_arc", issue = "112566")] pub struct UniqueArc< T: ?Sized, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { ptr: NonNull>, // Define the ownership of `ArcInner` for drop-check @@ -4801,7 +4800,7 @@ impl UniqueArc { #[cfg(not(no_global_oom_handling))] #[unstable(feature = "unique_rc_arc", issue = "112566")] #[must_use] - // #[unstable(feature = "allocator_api", issue = "32838")] + // #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn new_in(data: T, alloc: A) -> Self { let (ptr, alloc) = Box::into_unique(Box::new_in( ArcInner { @@ -4956,7 +4955,7 @@ unsafe impl<#[may_dangle] T: ?Sized, A: Allocator> Drop for UniqueArc { } } -#[unstable(feature = "allocator_api", issue = "32838")] +#[stable(feature = "allocator_api", since = "CURRENT_RUSTC_VERSION")] unsafe impl Allocator for Arc { #[inline] fn allocate(&self, layout: Layout) -> Result, AllocError> { @@ -5008,5 +5007,5 @@ unsafe impl Allocator for Arc { } } -#[unstable(feature = "allocator_api", issue = "32838")] +#[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] unsafe impl AllocatorClone for Arc {} diff --git a/library/alloc/src/vec/drain.rs b/library/alloc/src/vec/drain.rs index d12dea20b33cb..0038c7918c1d5 100644 --- a/library/alloc/src/vec/drain.rs +++ b/library/alloc/src/vec/drain.rs @@ -21,7 +21,7 @@ use crate::alloc::{Allocator, Global}; pub struct Drain< 'a, T: 'a, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + 'a = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator + 'a = Global, > { /// Index of tail to preserve pub(super) tail_start: usize, @@ -58,7 +58,7 @@ impl<'a, T, A: Allocator> Drain<'a, T, A> { } /// Returns a reference to the underlying allocator. - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[must_use] #[inline] pub fn allocator(&self) -> &A { diff --git a/library/alloc/src/vec/extract_if.rs b/library/alloc/src/vec/extract_if.rs index a4c4c19682195..557eaeac5cb76 100644 --- a/library/alloc/src/vec/extract_if.rs +++ b/library/alloc/src/vec/extract_if.rs @@ -22,7 +22,7 @@ pub struct ExtractIf< 'a, T, F, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { vec: &'a mut Vec, /// The index of the item that will be inspected by the next call to `next`. @@ -50,7 +50,7 @@ impl<'a, T, F, A: Allocator> ExtractIf<'a, T, F, A> { } /// Returns a reference to the underlying allocator. - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn allocator(&self) -> &A { self.vec.allocator() diff --git a/library/alloc/src/vec/into_iter.rs b/library/alloc/src/vec/into_iter.rs index 4b25634326e16..6a7672ea5f2c7 100644 --- a/library/alloc/src/vec/into_iter.rs +++ b/library/alloc/src/vec/into_iter.rs @@ -44,7 +44,7 @@ macro non_null { #[rustc_insignificant_dtor] pub struct IntoIter< T, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { pub(super) buf: NonNull, pub(super) phantom: PhantomData, @@ -108,7 +108,7 @@ impl IntoIter { } /// Returns a reference to the underlying allocator. - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[inline] pub fn allocator(&self) -> &A { &self.alloc diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index a619aa6e5427b..4aa567ce6dd5d 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -433,7 +433,10 @@ mod spec_extend; #[rustc_insignificant_dtor] #[doc(alias = "list")] #[doc(alias = "vector")] -pub struct Vec { +pub struct Vec< + T, + #[stable(feature = "allocator_api", since = "CURRENT_RUSTC_VERSION")] A: Allocator = Global, +> { buf: RawVec, len: usize, } @@ -936,7 +939,7 @@ const impl Vec { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::alloc::System; /// @@ -964,7 +967,7 @@ const impl Vec { /// assert_eq!(vec_units.capacity(), usize::MAX); /// ``` #[inline] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn with_capacity_in(capacity: usize, alloc: A) -> Self { Vec { buf: RawVec::with_capacity_in(capacity, alloc), len: 0 } } @@ -1050,14 +1053,13 @@ impl Vec { /// # Examples /// /// ``` - /// #![feature(allocator_api)] - /// /// use std::alloc::System; /// /// let vec: Vec = Vec::new_in(System); /// ``` #[inline] - #[unstable(feature = "allocator_api", issue = "32838")] + #[stable(feature = "allocator_api", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_unstable(feature = "allocator_ext", issue = "32838")] pub const fn new_in(alloc: A) -> Self { Vec { buf: RawVec::new_in(alloc), len: 0 } } @@ -1074,7 +1076,7 @@ impl Vec { /// Returns an error if the capacity exceeds `isize::MAX` _bytes_, /// or if the allocator reports allocation failure. #[inline] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] // #[unstable(feature = "try_with_capacity", issue = "91913")] pub fn try_with_capacity_in(capacity: usize, alloc: A) -> Result { Ok(Vec { buf: RawVec::try_with_capacity_in(capacity, alloc)?, len: 0 }) @@ -1128,7 +1130,7 @@ impl Vec { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::alloc::System; /// @@ -1157,7 +1159,7 @@ impl Vec { /// Using memory that was allocated elsewhere: /// /// ```rust - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::alloc::{AllocError, Allocator, Global, Layout}; /// @@ -1180,8 +1182,8 @@ impl Vec { /// } /// ``` #[inline] - #[unstable(feature = "allocator_api", issue = "32838")] - #[rustc_const_unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] + #[rustc_const_unstable(feature = "allocator_ext", issue = "32838")] pub const unsafe fn from_raw_parts_in( ptr: *mut T, length: usize, @@ -1245,7 +1247,7 @@ impl Vec { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::alloc::System; /// @@ -1272,7 +1274,7 @@ impl Vec { /// Using memory that was allocated elsewhere: /// /// ```rust - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::alloc::{AllocError, Allocator, Global, Layout}; /// @@ -1295,8 +1297,12 @@ impl Vec { /// } /// ``` #[inline] - #[unstable(feature = "allocator_api", issue = "32838")] - #[rustc_const_unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] + #[rustc_const_unstable( + feature = "allocator_ext", + issue = "32838", + implied_by = "allocator_api" + )] pub const unsafe fn from_parts_in( ptr: NonNull, length: usize, @@ -1328,7 +1334,7 @@ impl Vec { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::alloc::System; /// @@ -1349,8 +1355,8 @@ impl Vec { /// assert_eq!(rebuilt, [4294967295, 0, 1]); /// ``` #[must_use = "losing the pointer will leak memory"] - #[unstable(feature = "allocator_api", issue = "32838")] - #[rustc_const_unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] + #[rustc_const_unstable(feature = "allocator_ext", issue = "32838")] pub const fn into_raw_parts_with_alloc(self) -> (*mut T, usize, usize, A) { let mut me = ManuallyDrop::new(self); let len = me.len(); @@ -1378,7 +1384,7 @@ impl Vec { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// /// use std::alloc::System; /// @@ -1399,8 +1405,12 @@ impl Vec { /// assert_eq!(rebuilt, [4294967295, 0, 1]); /// ``` #[must_use = "losing the pointer will leak memory"] - #[unstable(feature = "allocator_api", issue = "32838")] - #[rustc_const_unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] + #[rustc_const_unstable( + feature = "allocator_ext", + issue = "32838", + implied_by = "allocator_api" + )] pub const fn into_parts_with_alloc(self) -> (NonNull, usize, usize, A) { let (ptr, len, capacity, alloc) = self.into_raw_parts_with_alloc(); // SAFETY: A `Vec` always has a non-null pointer. @@ -2118,7 +2128,7 @@ impl Vec { } /// Returns a reference to the underlying allocator. - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[rustc_const_unstable(feature = "const_heap", issue = "79597")] #[inline] pub const fn allocator(&self) -> &A { @@ -3775,7 +3785,7 @@ pub fn from_elem(elem: T, n: usize) -> Vec { #[doc(hidden)] #[cfg(not(no_global_oom_handling))] -#[unstable(feature = "allocator_api", issue = "32838")] +#[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn from_elem_in(elem: T, n: usize, alloc: A) -> Vec { ::from_elem(elem, n, alloc) } diff --git a/library/alloc/src/vec/peek_mut.rs b/library/alloc/src/vec/peek_mut.rs index 979bcaa1111d5..c1da49eddb75d 100644 --- a/library/alloc/src/vec/peek_mut.rs +++ b/library/alloc/src/vec/peek_mut.rs @@ -15,7 +15,7 @@ use crate::fmt; pub struct PeekMut< 'a, T, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { vec: &'a mut Vec, } diff --git a/library/alloc/src/vec/splice.rs b/library/alloc/src/vec/splice.rs index 99ebcb4ada296..b82b2d728624d 100644 --- a/library/alloc/src/vec/splice.rs +++ b/library/alloc/src/vec/splice.rs @@ -20,7 +20,7 @@ use crate::alloc::{Allocator, Global}; pub struct Splice< 'a, I: Iterator + 'a, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + 'a = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator + 'a = Global, > { pub(super) drain: Drain<'a, I::Item, A>, pub(super) replace_with: I, diff --git a/library/alloctests/lib.rs b/library/alloctests/lib.rs index 83b017b7625b9..985ee0fd4e522 100644 --- a/library/alloctests/lib.rs +++ b/library/alloctests/lib.rs @@ -14,7 +14,7 @@ // // Library features: // tidy-alphabetical-start -#![feature(allocator_api)] +#![feature(allocator_ext)] #![feature(array_into_iter_constructors)] #![feature(char_internals)] #![feature(const_alloc_error)] diff --git a/library/alloctests/tests/lib.rs b/library/alloctests/tests/lib.rs index b2a3e8f8f8e2a..9bcb545c8e87d 100644 --- a/library/alloctests/tests/lib.rs +++ b/library/alloctests/tests/lib.rs @@ -3,7 +3,7 @@ #![deny(implicit_provenance_casts)] #![deny(unsafe_op_in_unsafe_fn)] #![feature(alloc_io)] -#![feature(allocator_api)] +#![feature(allocator_ext)] #![feature(binary_heap_drain_sorted)] #![feature(binary_heap_into_iter_sorted)] #![feature(binary_heap_pop_if)] diff --git a/library/alloctests/tests/vec_deque_alloc_error.rs b/library/alloctests/tests/vec_deque_alloc_error.rs index 21a9118a05bd6..863af31e1cd1e 100644 --- a/library/alloctests/tests/vec_deque_alloc_error.rs +++ b/library/alloctests/tests/vec_deque_alloc_error.rs @@ -1,4 +1,4 @@ -#![feature(alloc_error_hook, allocator_api)] +#![feature(alloc_error_hook, allocator_ext)] use std::alloc::{AllocError, Allocator, Layout, System, set_alloc_error_hook}; use std::collections::VecDeque; diff --git a/library/core/src/alloc/mod.rs b/library/core/src/alloc/mod.rs index 7816709ac4663..1a66bb50074d5 100644 --- a/library/core/src/alloc/mod.rs +++ b/library/core/src/alloc/mod.rs @@ -27,19 +27,15 @@ use crate::ptr::{self, NonNull}; /// that may be due to resource exhaustion or to /// something wrong when combining the given input arguments with this /// allocator. -#[unstable(feature = "allocator_api", issue = "32838")] +#[stable(feature = "allocator_api", since = "CURRENT_RUSTC_VERSION")] #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub struct AllocError; -#[unstable( - feature = "allocator_api", - reason = "the precise API and guarantees it provides may be tweaked.", - issue = "32838" -)] +#[stable(feature = "allocator_api", since = "CURRENT_RUSTC_VERSION")] impl Error for AllocError {} // (we need this for downstream impl of trait Error) -#[unstable(feature = "allocator_api", issue = "32838")] +#[stable(feature = "allocator_api", since = "CURRENT_RUSTC_VERSION")] impl fmt::Display for AllocError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str("memory allocation failed") @@ -63,7 +59,7 @@ impl fmt::Display for AllocError { /// When this is the case, we refer to those allocators as being *equivalent* to /// each other. /// -/// The following conditions are sufficient conditions for allocators to be equivalent. +/// The following conditions are necessary for allocators to be equivalent: /// * An allocator is equivalent to itself. (Equivalence is reflexive.) /// * If an allocator is equivalent to a second allocator, then /// the second allocator is also equivalent to the first. (Equivalence is symmetric.) @@ -73,7 +69,7 @@ impl fmt::Display for AllocError { /// (Equivalence is transitive.) /// * Moving, subtyping, unsize-coercing, or trait-upcasting an allocator does not change /// what the allocator is equivalent to. -/// * Copying or cloning allocator results in an allocator that's +/// * Copying or cloning an allocator results in an allocator that's /// equivalent to the initial allocator, should the [`AllocatorClone`] trait /// be implemented. /// @@ -104,14 +100,14 @@ impl fmt::Display for AllocError { /// * The memory block is deallocated. This occurs when the memory block /// is passed as an argument to a [`deallocate`] call, or when it is passed /// as an argument to a [`grow`], [`grow_zeroed`] or [`shrink`] call that returns `Ok`. -/// * All (equivalent) allocators that this memory block is allocated with, -/// each has one of the following happen to them: +/// * *All* (equivalent) allocators that this memory block is allocated with has one of +/// the following happen to it: /// * The allocator's destructor runs. -/// * The allocator is mutated through public API taking `&mut` access. +/// * The allocator is mutated through an untrusted API taking `&mut` access. /// * One of the borrow-checker lifetimes in the allocator's type expires. /// /// Note that these conditions imply that a collection may ensure that -/// any specific currently allocated memory block won't be invalidated, by: +/// any specific currently allocated memory block won't be invalidated by: /// * not deallocating that memory block, /// * owning an allocator that memory block is allocated with, and /// * not publicly exposing `&mut` access to that allocator. @@ -120,11 +116,11 @@ impl fmt::Display for AllocError { /// allowed to invalidate its memory blocks. Furthermore, unsafe public API /// of an allocator with `&` access must document that they invalidate /// memory blocks (e.g., by calling `deallocate`) if they do. Therefore, -/// collections may safely expose `&` access to its allocator. +/// a collection may safely expose `&` access to its allocator. /// -/// Also note that, even in cases where are other "alive" allocators known to be -/// equivalent to a given collection's allocator, most collections still should -/// not publicly expose `&mut` access to its allocator. The fact that there are +/// Also note that, even in cases where there are other "alive" allocators known +/// to be equivalent to a given collection's allocator, most collections still should +/// not publicly expose `&mut` access to their allocators. The fact that there are /// other "alive" allocators would prevent this `&mut` access from invalidating /// the collection's memory block, but public `&mut` access is still likely to /// be unsound, since a user could replace the collection's allocator with @@ -140,8 +136,8 @@ impl fmt::Display for AllocError { /// /// ### Memory fitting /// -/// Some of the methods require that a `layout` *fit* a memory block or vice versa. This means that the -/// following conditions must hold: +/// Some of the methods require that a `layout` *fits* a memory block or vice versa. This means +/// that the following conditions must hold: /// * the memory block must be *currently allocated* with alignment of [`layout.align()`], and /// * [`layout.size()`] must fall in the range `min ..= max`, where: /// - `min` is the size of the layout used to allocate the block, and @@ -154,7 +150,7 @@ impl fmt::Display for AllocError { /// # Safety /// /// Implementors of `Allocator` must ensure that a memory block that -/// is [*currently allocated*] by the allocator points to valid memory, +/// is [*currently allocated*] by the allocator points to valid memory /// until that memory block is [*invalidated*]. The implementor must also /// not violate this invariant of `Allocator` via allocator equivalences /// that are in the implementor's control (e.g., via an incorrect `unsafe @@ -186,7 +182,7 @@ impl fmt::Display for AllocError { // and make sure they cannot be triggered before relaxing this: // https://rust.tf/156490 // https://rust.tf/159982 -#[unstable(feature = "allocator_api", issue = "32838")] +#[stable(feature = "allocator_api", since = "CURRENT_RUSTC_VERSION")] #[rustc_const_unstable(feature = "const_heap", issue = "79597")] pub const unsafe trait Allocator { /// Attempts to allocate a block of memory. @@ -203,7 +199,7 @@ pub const unsafe trait Allocator { /// Note that the returned block of memory is considered [*currently allocated*] /// with this allocator (and equivalent allocators). /// Therefore, it is the responsibility of implementors of `Allocator` to make sure that - /// this block of memory points to valid memory until the block is [*invalidated*] + /// this block of memory remains valid until it is [*invalidated*]. /// /// [*currently allocated*]: #currently-allocated-memory /// [*invalidated*]: #invalidating-memory-blocks @@ -221,6 +217,7 @@ pub const unsafe trait Allocator { /// call the [`handle_alloc_error`] function, rather than directly invoking `panic!` or similar. /// /// [`handle_alloc_error`]: ../../alloc/alloc/fn.handle_alloc_error.html + #[stable(feature = "allocator_api", since = "CURRENT_RUSTC_VERSION")] fn allocate(&self, layout: Layout) -> Result, AllocError>; /// Behaves like `allocate`, but also ensures that the returned memory is zero-initialized. @@ -238,6 +235,7 @@ pub const unsafe trait Allocator { /// call the [`handle_alloc_error`] function, rather than directly invoking `panic!` or similar. /// /// [`handle_alloc_error`]: ../../alloc/alloc/fn.handle_alloc_error.html + #[stable(feature = "allocator_api", since = "CURRENT_RUSTC_VERSION")] fn allocate_zeroed(&self, layout: Layout) -> Result, AllocError> { let ptr = self.allocate(layout)?; // SAFETY: `alloc` returns a valid memory block @@ -261,6 +259,7 @@ pub const unsafe trait Allocator { /// /// [*currently allocated*]: #currently-allocated-memory /// [*fit*]: #memory-fitting + #[stable(feature = "allocator_api", since = "CURRENT_RUSTC_VERSION")] unsafe fn deallocate(&self, ptr: NonNull, layout: Layout); /// Attempts to extend the memory block. @@ -302,6 +301,7 @@ pub const unsafe trait Allocator { /// call the [`handle_alloc_error`] function, rather than directly invoking `panic!` or similar. /// /// [`handle_alloc_error`]: ../../alloc/alloc/fn.handle_alloc_error.html + #[stable(feature = "allocator_api", since = "CURRENT_RUSTC_VERSION")] unsafe fn grow( &self, ptr: NonNull, @@ -362,6 +362,7 @@ pub const unsafe trait Allocator { /// call the [`handle_alloc_error`] function, rather than directly invoking `panic!` or similar. /// /// [`handle_alloc_error`]: ../../alloc/alloc/fn.handle_alloc_error.html + #[stable(feature = "allocator_api", since = "CURRENT_RUSTC_VERSION")] unsafe fn grow_zeroed( &self, ptr: NonNull, @@ -428,6 +429,7 @@ pub const unsafe trait Allocator { /// call the [`handle_alloc_error`] function, rather than directly invoking `panic!` or similar. /// /// [`handle_alloc_error`]: ../../alloc/alloc/fn.handle_alloc_error.html + #[stable(feature = "allocator_api", since = "CURRENT_RUSTC_VERSION")] unsafe fn shrink( &self, ptr: NonNull, @@ -511,7 +513,7 @@ pub const unsafe trait Allocator { /// [`std::thread::park`]: ../../std/thread/fn.park.html /// [`std::thread::Thread`]: ../../std/thread/struct.Thread.html /// [`unpark`]: ../../std/thread/struct.Thread.html#method.unpark -#[unstable(feature = "allocator_api", issue = "32838")] +#[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] #[expect(multiple_supertrait_upcastable)] pub unsafe trait GlobalAllocator: StaticAllocator + Sync + 'static {} @@ -527,7 +529,7 @@ pub unsafe trait GlobalAllocator: StaticAllocator + Sync + 'static {} /// It must also be the case that types which are `AllocatorClone` are either explicitly not /// copyable (such as by containing a `!Copy` field) or that copying them also respects allocator /// equivalence as if it had been a clone. -#[unstable(feature = "allocator_api", issue = "32838")] +#[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub unsafe trait AllocatorClone: Allocator + Clone {} /// Marks that an allocator and its supertypes will never invalidate currently allocated @@ -557,10 +559,10 @@ pub unsafe trait AllocatorClone: Allocator + Clone {} /// /// [`Pin`]: ../../core/pin/struct.Pin.html /// [unsound]: https://github.com/rust-lang/rust/issues/157089 -#[unstable(feature = "allocator_api", issue = "32838")] +#[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub unsafe trait StaticAllocator: Allocator {} -#[unstable(feature = "allocator_api", issue = "32838")] +#[stable(feature = "allocator_api", since = "CURRENT_RUSTC_VERSION")] #[rustc_const_unstable(feature = "const_heap", issue = "79597")] const unsafe impl Allocator for &A where @@ -616,7 +618,7 @@ where } } -#[unstable(feature = "allocator_api", issue = "32838")] +#[stable(feature = "allocator_api", since = "CURRENT_RUSTC_VERSION")] unsafe impl Allocator for &mut A where A: Allocator + ?Sized, @@ -671,10 +673,10 @@ where } } -#[unstable(feature = "allocator_api", issue = "32838")] +#[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] unsafe impl AllocatorClone for &A {} // If an allocator is `StaticAllocator` all equivalent allocators must also uphold // its semantics, and references are equivalent to the allocator they reference. -#[unstable(feature = "allocator_api", issue = "32838")] +#[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] unsafe impl StaticAllocator for &A {} diff --git a/library/core/src/ptr/non_null.rs b/library/core/src/ptr/non_null.rs index bf5355ffc141d..9f92071c5e510 100644 --- a/library/core/src/ptr/non_null.rs +++ b/library/core/src/ptr/non_null.rs @@ -1559,7 +1559,7 @@ impl NonNull<[T]> { /// # Examples /// /// ```rust - /// #![feature(allocator_api, ptr_as_uninit)] + /// #![feature(ptr_as_uninit)] /// /// use std::alloc::{Allocator, Layout, Global}; /// use std::mem::MaybeUninit; diff --git a/library/std/src/alloc.rs b/library/std/src/alloc.rs index 558ab0f2fc66d..c4dfa79402ce4 100644 --- a/library/std/src/alloc.rs +++ b/library/std/src/alloc.rs @@ -145,10 +145,10 @@ use crate::{hint, mem, ptr}; #[derive_const(Clone, Default)] pub struct System; -#[unstable(feature = "allocator_api", issue = "32838")] +#[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] unsafe impl core::alloc::AllocatorClone for System {} -#[unstable(feature = "allocator_api", issue = "32838")] +#[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] unsafe impl core::alloc::StaticAllocator for System {} impl System { @@ -216,7 +216,7 @@ impl System { // The Allocator impl checks the layout size to be non-zero and forwards to the // platform functions in `std::sys::*::alloc`. -#[unstable(feature = "allocator_api", issue = "32838")] +#[stable(feature = "allocator_api", since = "CURRENT_RUSTC_VERSION")] unsafe impl Allocator for System { #[inline] fn allocate(&self, layout: Layout) -> Result, AllocError> { @@ -303,7 +303,7 @@ unsafe impl Allocator for System { } } -#[unstable(feature = "allocator_api", issue = "32838")] +#[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] unsafe impl GlobalAllocator for System {} static HOOK: AtomicPtr<()> = AtomicPtr::new(ptr::null_mut()); diff --git a/library/std/src/collections/hash/map.rs b/library/std/src/collections/hash/map.rs index fef0b1b4df88e..2507e3c50af58 100644 --- a/library/std/src/collections/hash/map.rs +++ b/library/std/src/collections/hash/map.rs @@ -246,7 +246,7 @@ pub struct HashMap< K, V, S = RandomState, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { base: base::HashMap, } @@ -299,7 +299,7 @@ impl HashMap { /// # Examples /// /// ``` - /// # #![feature(allocator_api)] + /// # #![feature(allocator_ext)] /// use std::collections::HashMap; /// use std::alloc::Global; /// @@ -307,7 +307,7 @@ impl HashMap { /// ``` #[inline] #[must_use] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn new_in(alloc: A) -> Self { HashMap::with_hasher_in(Default::default(), alloc) } @@ -322,7 +322,7 @@ impl HashMap { /// # Examples /// /// ``` - /// # #![feature(allocator_api)] + /// # #![feature(allocator_ext)] /// use std::collections::HashMap; /// use std::alloc::Global; /// @@ -330,7 +330,7 @@ impl HashMap { /// ``` #[inline] #[must_use] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn with_capacity_in(capacity: usize, alloc: A) -> Self { HashMap::with_capacity_and_hasher_in(capacity, Default::default(), alloc) } @@ -418,7 +418,7 @@ impl HashMap { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// use std::alloc::Global; /// use std::collections::HashMap; /// use std::hash::RandomState; @@ -428,7 +428,7 @@ impl HashMap { /// ``` #[inline] #[must_use] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn with_hasher_in(hash_builder: S, alloc: A) -> Self { HashMap { base: base::HashMap::with_hasher_in(hash_builder, alloc) } } @@ -451,7 +451,7 @@ impl HashMap { /// # Examples /// /// ``` - /// #![feature(allocator_api)] + /// #![feature(allocator_ext)] /// use std::alloc::Global; /// use std::collections::HashMap; /// use std::hash::RandomState; @@ -461,7 +461,7 @@ impl HashMap { /// ``` #[inline] #[must_use] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn with_capacity_and_hasher_in(capacity: usize, hash_builder: S, alloc: A) -> Self { HashMap { base: base::HashMap::with_capacity_and_hasher_in(capacity, hash_builder, alloc) } } @@ -1660,7 +1660,7 @@ impl Default for IterMut<'_, K, V> { pub struct IntoIter< K, V, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { base: base::IntoIter, } @@ -1798,7 +1798,7 @@ pub struct Drain< 'a, K: 'a, V: 'a, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { base: base::Drain<'a, K, V, A>, } @@ -1835,7 +1835,7 @@ pub struct ExtractIf< K, V, F, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { base: base::ExtractIf<'a, K, V, F, A>, } @@ -1892,7 +1892,7 @@ impl Default for ValuesMut<'_, K, V> { pub struct IntoKeys< K, V, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { inner: IntoIter, } @@ -1926,7 +1926,7 @@ impl Default for IntoKeys { pub struct IntoValues< K, V, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { inner: IntoIter, } @@ -1950,7 +1950,7 @@ pub enum Entry< 'a, K: 'a, V: 'a, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { /// An occupied entry. #[stable(feature = "rust1", since = "1.0.0")] @@ -1978,7 +1978,7 @@ pub struct OccupiedEntry< 'a, K: 'a, V: 'a, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { base: base::RustcOccupiedEntry<'a, K, V, A>, } @@ -2000,7 +2000,7 @@ pub struct VacantEntry< 'a, K: 'a, V: 'a, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { base: base::RustcVacantEntry<'a, K, V, A>, } @@ -2021,7 +2021,7 @@ pub struct OccupiedError< 'a, K: 'a, V: 'a, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { /// The entry in the map that was already occupied. pub entry: OccupiedEntry<'a, K, V, A>, diff --git a/library/std/src/collections/hash/set.rs b/library/std/src/collections/hash/set.rs index b0a8e8ff42149..d5ff5e4c1c9dd 100644 --- a/library/std/src/collections/hash/set.rs +++ b/library/std/src/collections/hash/set.rs @@ -126,7 +126,7 @@ use crate::ops::{BitAnd, BitOr, BitXor, Sub}; pub struct HashSet< T, S = RandomState, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { base: base::HashSet, } @@ -179,7 +179,7 @@ impl HashSet { /// # Examples /// /// ``` - /// # #![feature(allocator_api)] + /// # #![feature(allocator_ext)] /// use std::alloc::Global; /// use std::collections::HashSet; /// @@ -187,7 +187,7 @@ impl HashSet { /// ``` #[inline] #[must_use] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn new_in(alloc: A) -> HashSet { HashSet::with_hasher_in(Default::default(), alloc) } @@ -201,7 +201,7 @@ impl HashSet { /// # Examples /// /// ``` - /// # #![feature(allocator_api)] + /// # #![feature(allocator_ext)] /// use std::collections::HashSet; /// use std::alloc::Global; /// @@ -209,7 +209,7 @@ impl HashSet { /// ``` #[inline] #[must_use] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn with_capacity_in(capacity: usize, alloc: A) -> HashSet { HashSet::with_capacity_and_hasher_in(capacity, Default::default(), alloc) } @@ -297,7 +297,7 @@ impl HashSet { /// # Examples /// /// ``` - /// # #![feature(allocator_api)] + /// # #![feature(allocator_ext)] /// use std::alloc::Global; /// use std::collections::HashSet; /// use std::hash::RandomState; @@ -307,7 +307,7 @@ impl HashSet { /// ``` #[inline] #[must_use] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn with_hasher_in(hasher: S, alloc: A) -> HashSet { HashSet { base: base::HashSet::with_hasher_in(hasher, alloc) } } @@ -330,7 +330,7 @@ impl HashSet { /// # Examples /// /// ``` - /// # #![feature(allocator_api)] + /// # #![feature(allocator_ext)] /// use std::alloc::Global; /// use std::collections::HashSet; /// use std::hash::RandomState; @@ -340,7 +340,7 @@ impl HashSet { /// ``` #[inline] #[must_use] - #[unstable(feature = "allocator_api", issue = "32838")] + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] pub fn with_capacity_and_hasher_in(capacity: usize, hasher: S, alloc: A) -> HashSet { HashSet { base: base::HashSet::with_capacity_and_hasher_in(capacity, hasher, alloc) } } @@ -1468,7 +1468,7 @@ impl Default for Iter<'_, K> { #[stable(feature = "rust1", since = "1.0.0")] pub struct IntoIter< K, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { base: base::IntoIter, } @@ -1502,7 +1502,7 @@ impl Default for IntoIter { pub struct Drain< 'a, K: 'a, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { base: base::Drain<'a, K, A>, } @@ -1529,7 +1529,7 @@ pub struct ExtractIf< 'a, K, F, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { base: base::ExtractIf<'a, K, F, A>, } @@ -1558,7 +1558,7 @@ pub struct Intersection< 'a, T: 'a, S: 'a, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { // iterator of the first set iter: Iter<'a, T>, @@ -1590,7 +1590,7 @@ pub struct Difference< 'a, T: 'a, S: 'a, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { // iterator of the first set iter: Iter<'a, T>, @@ -1622,7 +1622,7 @@ pub struct SymmetricDifference< 'a, T: 'a, S: 'a, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { iter: Chain, Difference<'a, T, S, A>>, } @@ -1651,7 +1651,7 @@ pub struct Union< 'a, T: 'a, S: 'a, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { iter: Chain, Difference<'a, T, S, A>>, } @@ -2145,7 +2145,7 @@ pub enum Entry< 'a, T, S, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { /// An occupied entry. /// @@ -2237,7 +2237,7 @@ pub struct OccupiedEntry< 'a, T, S, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { base: base::OccupiedEntry<'a, T, S, A>, } @@ -2282,7 +2282,7 @@ pub struct VacantEntry< 'a, T, S, - #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, + #[unstable(feature = "allocator_ext", issue = "32838", implied_by = "allocator_api")] A: Allocator = Global, > { base: base::VacantEntry<'a, T, S, A>, } diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 22ac7443f464b..3c8f5f7a094bd 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -400,7 +400,7 @@ // Library features (alloc): // tidy-alphabetical-start #![feature(alloc_io)] -#![feature(allocator_api)] +#![feature(allocator_ext)] #![feature(buf_read_has_data_left)] #![feature(clone_from_ref)] #![feature(get_mut_unchecked)] diff --git a/src/doc/unstable-book/src/library-features/allocator-api.md b/src/doc/unstable-book/src/library-features/allocator-ext.md similarity index 96% rename from src/doc/unstable-book/src/library-features/allocator-api.md rename to src/doc/unstable-book/src/library-features/allocator-ext.md index 9f045ce08a433..f1e7551bdfa08 100644 --- a/src/doc/unstable-book/src/library-features/allocator-api.md +++ b/src/doc/unstable-book/src/library-features/allocator-ext.md @@ -1,4 +1,4 @@ -# `allocator_api` +# `allocator_ext` The tracking issue for this feature is [#32838] diff --git a/src/tools/clippy/tests/ui/vec_box_sized.rs b/src/tools/clippy/tests/ui/vec_box_sized.rs index 5cc140953cecc..3694d32be9eb0 100644 --- a/src/tools/clippy/tests/ui/vec_box_sized.rs +++ b/src/tools/clippy/tests/ui/vec_box_sized.rs @@ -1,7 +1,7 @@ //@no-rustfix #![warn(clippy::vec_box)] -#![feature(allocator_api)] +#![feature(allocator_ext)] use std::alloc::{AllocError, Allocator, Layout}; use std::ptr::NonNull; diff --git a/src/tools/miri/tests/fail/alloc/alloc_error_handler.rs b/src/tools/miri/tests/fail/alloc/alloc_error_handler.rs index 35b8e20e56b3c..71e4eadc4e0b8 100644 --- a/src/tools/miri/tests/fail/alloc/alloc_error_handler.rs +++ b/src/tools/miri/tests/fail/alloc/alloc_error_handler.rs @@ -1,5 +1,5 @@ //@error-in-other-file: aborted -#![feature(allocator_api)] +#![feature(allocator_ext)] use std::alloc::*; diff --git a/src/tools/miri/tests/fail/alloc/alloc_error_handler_custom.rs b/src/tools/miri/tests/fail/alloc/alloc_error_handler_custom.rs index 8d41002735cc9..72f45be61b299 100644 --- a/src/tools/miri/tests/fail/alloc/alloc_error_handler_custom.rs +++ b/src/tools/miri/tests/fail/alloc/alloc_error_handler_custom.rs @@ -1,7 +1,7 @@ //@compile-flags: -Cpanic=abort #![feature(core_intrinsics)] #![feature(alloc_error_handler)] -#![feature(allocator_api)] +#![feature(allocator_ext)] #![no_std] #![no_main] diff --git a/src/tools/miri/tests/fail/alloc/alloc_error_handler_no_std.rs b/src/tools/miri/tests/fail/alloc/alloc_error_handler_no_std.rs index f73f8e3e7e196..c7c51c95e9c26 100644 --- a/src/tools/miri/tests/fail/alloc/alloc_error_handler_no_std.rs +++ b/src/tools/miri/tests/fail/alloc/alloc_error_handler_no_std.rs @@ -1,7 +1,7 @@ //@compile-flags: -Cpanic=abort #![feature(core_intrinsics)] #![feature(alloc_error_handler)] -#![feature(allocator_api)] +#![feature(allocator_ext)] #![no_std] #![no_main] diff --git a/src/tools/miri/tests/fail/alloc/global_system_mixup.rs b/src/tools/miri/tests/fail/alloc/global_system_mixup.rs index bbf069b7a2def..f80ac906fd952 100644 --- a/src/tools/miri/tests/fail/alloc/global_system_mixup.rs +++ b/src/tools/miri/tests/fail/alloc/global_system_mixup.rs @@ -8,7 +8,7 @@ //@normalize-stderr-test: "alloc::[A-Za-z]+::" -> "alloc::PLATFORM::" //@normalize-stderr-test: "alloc/[A-Za-z]+.rs" -> "alloc/PLATFORM.rs" -#![feature(allocator_api, slice_ptr_get)] +#![feature(allocator_ext, slice_ptr_get)] use std::alloc::{Allocator, Global, Layout, System}; diff --git a/src/tools/miri/tests/fail/both_borrows/box-custom-alloc-aliasing.rs b/src/tools/miri/tests/fail/both_borrows/box-custom-alloc-aliasing.rs index 93626a354d037..7310be2a64510 100644 --- a/src/tools/miri/tests/fail/both_borrows/box-custom-alloc-aliasing.rs +++ b/src/tools/miri/tests/fail/both_borrows/box-custom-alloc-aliasing.rs @@ -4,7 +4,7 @@ //@revisions: stack tree //@[tree]compile-flags: -Zmiri-tree-borrows //@normalize-stderr-test: "\[0x[a-fx\d.]+\]" -> "[RANGE]" -#![feature(allocator_api)] +#![feature(allocator_ext)] use std::alloc::{AllocError, Allocator, Layout}; use std::cell::{Cell, UnsafeCell}; diff --git a/src/tools/miri/tests/fail/validity/box-custom-alloc-dangling-ptr.rs b/src/tools/miri/tests/fail/validity/box-custom-alloc-dangling-ptr.rs index 5fb81296494e5..cc0bd3fc3a22c 100644 --- a/src/tools/miri/tests/fail/validity/box-custom-alloc-dangling-ptr.rs +++ b/src/tools/miri/tests/fail/validity/box-custom-alloc-dangling-ptr.rs @@ -1,5 +1,5 @@ //! Ensure that a box with a custom allocator detects when the pointer is dangling. -#![feature(allocator_api)] +#![feature(allocator_ext)] // This should not need the aliasing model. //@compile-flags: -Zmiri-disable-stacked-borrows use std::alloc::Layout; diff --git a/src/tools/miri/tests/fail/validity/box-custom-alloc-invalid-alloc.rs b/src/tools/miri/tests/fail/validity/box-custom-alloc-invalid-alloc.rs index 101a550593f90..0ed54d0112dd4 100644 --- a/src/tools/miri/tests/fail/validity/box-custom-alloc-invalid-alloc.rs +++ b/src/tools/miri/tests/fail/validity/box-custom-alloc-invalid-alloc.rs @@ -1,5 +1,5 @@ //! Ensure that a box with a custom allocator detects when the allocator itself is invalid. -#![feature(allocator_api)] +#![feature(allocator_ext)] // This should not need the aliasing model. //@compile-flags: -Zmiri-disable-stacked-borrows use std::alloc::Layout; diff --git a/src/tools/miri/tests/panic/alloc_error_handler_hook.rs b/src/tools/miri/tests/panic/alloc_error_handler_hook.rs index a1eadb45fd13b..f7516ce86e883 100644 --- a/src/tools/miri/tests/panic/alloc_error_handler_hook.rs +++ b/src/tools/miri/tests/panic/alloc_error_handler_hook.rs @@ -1,4 +1,4 @@ -#![feature(allocator_api, alloc_error_hook)] +#![feature(allocator_ext, alloc_error_hook)] use std::alloc::*; diff --git a/src/tools/miri/tests/pass/box-custom-alloc-aliasing.rs b/src/tools/miri/tests/pass/box-custom-alloc-aliasing.rs index 6b3365839acd1..69d71c31f7e72 100644 --- a/src/tools/miri/tests/pass/box-custom-alloc-aliasing.rs +++ b/src/tools/miri/tests/pass/box-custom-alloc-aliasing.rs @@ -5,7 +5,7 @@ //! accept such code. //@compile-flags: -Zmiri-tree-borrows -Zmiri-tree-borrows-relax-custom-allocator-uniqueness -Zmiri-tree-borrows-implicit-writes -#![feature(allocator_api)] +#![feature(allocator_ext)] use std::alloc::{AllocError, Allocator, Layout}; use std::cell::{Cell, UnsafeCell}; diff --git a/src/tools/miri/tests/pass/box-custom-alloc.rs b/src/tools/miri/tests/pass/box-custom-alloc.rs index 9a1a2f935921e..409e646dc85ec 100644 --- a/src/tools/miri/tests/pass/box-custom-alloc.rs +++ b/src/tools/miri/tests/pass/box-custom-alloc.rs @@ -1,7 +1,7 @@ //@revisions: stack tree tree_implicit_writes //@[tree_implicit_writes]compile-flags: -Zmiri-tree-borrows -Zmiri-tree-borrows-implicit-writes //@[tree]compile-flags: -Zmiri-tree-borrows -#![feature(allocator_api)] +#![feature(allocator_ext)] use std::alloc::{AllocError, Allocator, Layout}; use std::cell::Cell; diff --git a/src/tools/miri/tests/pass/global_allocator.rs b/src/tools/miri/tests/pass/global_allocator.rs index ecb3a5e46e3a4..a7512df6c21fc 100644 --- a/src/tools/miri/tests/pass/global_allocator.rs +++ b/src/tools/miri/tests/pass/global_allocator.rs @@ -1,4 +1,4 @@ -#![feature(allocator_api, slice_ptr_get)] +#![feature(allocator_ext, slice_ptr_get)] use std::alloc::{Allocator as _, Global, GlobalAlloc, Layout, System}; diff --git a/src/tools/miri/tests/pass/heap_allocator.rs b/src/tools/miri/tests/pass/heap_allocator.rs index 2c38dcb49f1ce..95e02e5470523 100644 --- a/src/tools/miri/tests/pass/heap_allocator.rs +++ b/src/tools/miri/tests/pass/heap_allocator.rs @@ -1,4 +1,4 @@ -#![feature(allocator_api, slice_ptr_get)] +#![feature(allocator_ext, slice_ptr_get)] use std::alloc::{Allocator, Global, Layout, System}; use std::ptr::NonNull; diff --git a/tests/incremental/lint-unused-features.rs b/tests/incremental/lint-unused-features.rs index 0bf9730727f74..f2daed52de836 100644 --- a/tests/incremental/lint-unused-features.rs +++ b/tests/incremental/lint-unused-features.rs @@ -10,8 +10,8 @@ // Used library features #![feature(error_iter)] //[bfail]~^ ERROR feature `error_iter` is declared but not used -#![cfg_attr(all(), feature(allocator_api))] -//[bfail]~^ ERROR feature `allocator_api` is declared but not used +#![cfg_attr(all(), feature(allocator_ext))] +//[bfail]~^ ERROR feature `allocator_ext` is declared but not used macro m() {} pub fn use_decl_macro() { @@ -28,8 +28,7 @@ pub fn use_error_iter(e: &(dyn std::error::Error + 'static)) { #[cfg(rpass)] pub fn use_allocator_api() { - use std::alloc::Global; - let _ = Vec::::new_in(Global); + let _a: Box; } fn main() {} diff --git a/tests/mir-opt/box_conditional_drop_allocator.rs b/tests/mir-opt/box_conditional_drop_allocator.rs index 741c396b0c2d7..766c81340f6e8 100644 --- a/tests/mir-opt/box_conditional_drop_allocator.rs +++ b/tests/mir-opt/box_conditional_drop_allocator.rs @@ -1,7 +1,7 @@ //@ skip-filecheck //@ test-mir-pass: ElaborateDrops //@ needs-unwind -#![feature(allocator_api)] +#![feature(allocator_ext)] // Regression test for #131082. // Testing that the allocator of a Box is dropped in conditional drops diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.rs b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.rs index 08347f71b4239..1613b8cb8c2c2 100644 --- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.rs +++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.rs @@ -3,7 +3,7 @@ // EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -#![feature(allocator_api)] +#![feature(allocator_ext)] use std::alloc::{Allocator, Global, Layout}; diff --git a/tests/run-make/std-core-cycle/bar.rs b/tests/run-make/std-core-cycle/bar.rs index 9f5e7c29bddd7..d1a3c5089dddb 100644 --- a/tests/run-make/std-core-cycle/bar.rs +++ b/tests/run-make/std-core-cycle/bar.rs @@ -1,4 +1,4 @@ -#![feature(allocator_api)] +#![feature(allocator_ext)] #![crate_type = "rlib"] use std::alloc::*; diff --git a/tests/ui/README.md b/tests/ui/README.md index a3617fb6b07c9..b1cdafc616b23 100644 --- a/tests/ui/README.md +++ b/tests/ui/README.md @@ -18,7 +18,7 @@ See . ## `tests/ui/allocator` -These tests exercise `#![feature(allocator_api)]` and the `#[global_allocator]` attribute. +These tests exercise `#![feature(allocator_ext)]` and the `#[global_allocator]` attribute. See [Allocator traits and `std::heap` #32838](https://github.com/rust-lang/rust/issues/32838). diff --git a/tests/ui/allocator/156920-allocator-clone.rs b/tests/ui/allocator/156920-allocator-clone.rs index 2b9966b68eca8..cf38c1f4b04fe 100644 --- a/tests/ui/allocator/156920-allocator-clone.rs +++ b/tests/ui/allocator/156920-allocator-clone.rs @@ -1,4 +1,4 @@ -#![feature(allocator_api)] +#![feature(allocator_ext)] use std::{ alloc::{Allocator, Global, System}, diff --git a/tests/ui/allocator/157089-box-pin-in.rs b/tests/ui/allocator/157089-box-pin-in.rs index 307a933bba6f6..f24092fd66745 100644 --- a/tests/ui/allocator/157089-box-pin-in.rs +++ b/tests/ui/allocator/157089-box-pin-in.rs @@ -1,4 +1,4 @@ -#![feature(allocator_api)] +#![feature(allocator_ext)] use std::{ alloc::{AllocError, Allocator, Layout}, diff --git a/tests/ui/allocator/159445-unsize-pin-box.rs b/tests/ui/allocator/159445-unsize-pin-box.rs index 391c8c95813a0..836d938d1d3c6 100644 --- a/tests/ui/allocator/159445-unsize-pin-box.rs +++ b/tests/ui/allocator/159445-unsize-pin-box.rs @@ -1,4 +1,4 @@ -#![feature(allocator_api)] +#![feature(allocator_ext)] use std::{ alloc::{AllocError, Allocator, Layout}, diff --git a/tests/ui/allocator/alloc-shrink-oob-read.rs b/tests/ui/allocator/alloc-shrink-oob-read.rs index b9edfca3b7b51..120d327e2a344 100644 --- a/tests/ui/allocator/alloc-shrink-oob-read.rs +++ b/tests/ui/allocator/alloc-shrink-oob-read.rs @@ -4,7 +4,6 @@ //@ run-pass -#![feature(allocator_api)] #![feature(slice_ptr_get)] use std::alloc::{Allocator, Global, Layout, handle_alloc_error}; diff --git a/tests/ui/allocator/auxiliary/custom.rs b/tests/ui/allocator/auxiliary/custom.rs index b6835307dec2f..0cde0547351d2 100644 --- a/tests/ui/allocator/auxiliary/custom.rs +++ b/tests/ui/allocator/auxiliary/custom.rs @@ -1,6 +1,6 @@ //@ no-prefer-dynamic -#![feature(allocator_api)] +#![feature(allocator_ext)] #![crate_type = "rlib"] use std::alloc::{GlobalAlloc, System, Layout}; diff --git a/tests/ui/allocator/custom.rs b/tests/ui/allocator/custom.rs index 97de54dd4d6e3..eefd89c7b5a25 100644 --- a/tests/ui/allocator/custom.rs +++ b/tests/ui/allocator/custom.rs @@ -3,7 +3,6 @@ //@ aux-build:helper.rs //@ no-prefer-dynamic -#![feature(allocator_api)] #![feature(slice_ptr_get)] extern crate helper; diff --git a/tests/ui/allocator/dyn-compatible.rs b/tests/ui/allocator/dyn-compatible.rs index 9d8235e58d929..0e4ccb6fd162b 100644 --- a/tests/ui/allocator/dyn-compatible.rs +++ b/tests/ui/allocator/dyn-compatible.rs @@ -2,8 +2,6 @@ // Check that `Allocator` is dyn-compatible, this allows for polymorphic allocators -#![feature(allocator_api)] - use std::alloc::{Allocator, System}; fn ensure_dyn_compatible(_: &dyn Allocator) {} diff --git a/tests/ui/allocator/xcrate-use.rs b/tests/ui/allocator/xcrate-use.rs index 5934d73981305..a2b71c4498b13 100644 --- a/tests/ui/allocator/xcrate-use.rs +++ b/tests/ui/allocator/xcrate-use.rs @@ -4,7 +4,6 @@ //@ aux-build:helper.rs //@ no-prefer-dynamic -#![feature(allocator_api)] #![feature(slice_ptr_get)] extern crate custom; diff --git a/tests/ui/array-slice-vec/vec-res-add.stderr b/tests/ui/array-slice-vec/vec-res-add.stderr index 4e13dbd0366d0..6d5ad1d3c9694 100644 --- a/tests/ui/array-slice-vec/vec-res-add.stderr +++ b/tests/ui/array-slice-vec/vec-res-add.stderr @@ -8,6 +8,7 @@ LL | let k = i + j; | note: `Vec` does not implement `Add` --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + ::: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | = note: `Vec` is defined in another crate diff --git a/tests/ui/async-await/async-drop/async-drop-box-allocator.rs b/tests/ui/async-await/async-drop/async-drop-box-allocator.rs index 86ebf8a0ffd13..58aa5c422bd61 100644 --- a/tests/ui/async-await/async-drop/async-drop-box-allocator.rs +++ b/tests/ui/async-await/async-drop/async-drop-box-allocator.rs @@ -4,7 +4,7 @@ // It's used as the allocator of a `Box` which is conditionally moved out of. // Sync version is called in sync context, async version is called in async function. -#![feature(async_drop, allocator_api)] +#![feature(async_drop)] #![allow(incomplete_features)] use std::mem::ManuallyDrop; diff --git a/tests/ui/box/alloc-unstable-fail.rs b/tests/ui/box/alloc-unstable-fail.rs deleted file mode 100644 index e209af97d7f75..0000000000000 --- a/tests/ui/box/alloc-unstable-fail.rs +++ /dev/null @@ -1,6 +0,0 @@ -use std::boxed::Box; - -fn main() { - let _boxed: Box = Box::new(10); - //~^ ERROR use of unstable library feature `allocator_api` -} diff --git a/tests/ui/box/alloc-unstable-fail.stderr b/tests/ui/box/alloc-unstable-fail.stderr deleted file mode 100644 index 6ce63a7996662..0000000000000 --- a/tests/ui/box/alloc-unstable-fail.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0658]: use of unstable library feature `allocator_api` - --> $DIR/alloc-unstable-fail.rs:4:26 - | -LL | let _boxed: Box = Box::new(10); - | ^ - | - = note: see issue #32838 for more information - = help: add `#![feature(allocator_api)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/box/alloc-unstable.rs b/tests/ui/box/alloc-unstable.rs index b8c8bc0c70af4..e52c0a19dfc20 100644 --- a/tests/ui/box/alloc-unstable.rs +++ b/tests/ui/box/alloc-unstable.rs @@ -1,5 +1,7 @@ //@ run-pass -#![feature(allocator_api)] + +#![feature(allocator_ext)] + fn main() { let _boxed: Box = Box::new(10); } diff --git a/tests/ui/box/issue-95036.rs b/tests/ui/box/issue-95036.rs index f20f4b98437fd..505cb996fd57e 100644 --- a/tests/ui/box/issue-95036.rs +++ b/tests/ui/box/issue-95036.rs @@ -1,7 +1,7 @@ //@ compile-flags: -O //@ build-pass -#![feature(allocator_api)] +#![feature(allocator_ext)] #[inline(never)] pub fn by_ref(node: &mut Box<[u8; 1], &std::alloc::Global>) { diff --git a/tests/ui/box/large-allocator-ice.rs b/tests/ui/box/large-allocator-ice.rs index d5c7069cfb951..e85b308428fe4 100644 --- a/tests/ui/box/large-allocator-ice.rs +++ b/tests/ui/box/large-allocator-ice.rs @@ -1,5 +1,5 @@ //@ build-pass -#![feature(allocator_api)] +#![feature(allocator_ext)] #![allow(unused_must_use)] use std::alloc::Allocator; diff --git a/tests/ui/box/leak-alloc.rs b/tests/ui/box/leak-alloc.rs index e87650f42ab61..2308e0c585e3d 100644 --- a/tests/ui/box/leak-alloc.rs +++ b/tests/ui/box/leak-alloc.rs @@ -1,4 +1,4 @@ -#![feature(allocator_api)] +#![feature(allocator_ext)] use std::alloc::{AllocError, Allocator, Layout, System}; use std::ptr::NonNull; diff --git a/tests/ui/coherence/impl-foreign-for-box[foreign_local].rs b/tests/ui/coherence/impl-foreign-for-box[foreign_local].rs index 2a1d4828f4a93..ec243f0be8498 100644 --- a/tests/ui/coherence/impl-foreign-for-box[foreign_local].rs +++ b/tests/ui/coherence/impl-foreign-for-box[foreign_local].rs @@ -4,7 +4,7 @@ // Ensure that `Box` in particular isn't fundamental over // the allocator parameter (but is over T). -#![feature(allocator_api)] +#![feature(allocator_ext)] extern crate coherence_lib as lib; diff --git a/tests/ui/consts/const_in_pattern/suggest_equality_comparison_instead_of_pattern_matching.stderr b/tests/ui/consts/const_in_pattern/suggest_equality_comparison_instead_of_pattern_matching.stderr index 38440af675feb..ab823c8fc73b9 100644 --- a/tests/ui/consts/const_in_pattern/suggest_equality_comparison_instead_of_pattern_matching.stderr +++ b/tests/ui/consts/const_in_pattern/suggest_equality_comparison_instead_of_pattern_matching.stderr @@ -123,6 +123,7 @@ LL | V => {} | ^ constant of non-structural type | --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + ::: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | = note: `Vec<()>` is not usable in patterns | @@ -143,6 +144,7 @@ LL | if let V = vec![] {} | ^ constant of non-structural type | --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + ::: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | = note: `Vec<()>` is not usable in patterns | @@ -158,6 +160,7 @@ LL | let V = vec![] else { return; }; | ^ constant of non-structural type | --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + ::: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | = note: `Vec<()>` is not usable in patterns | @@ -173,6 +176,7 @@ LL | let V = Vec::new() else { return; }; | ^ constant of non-structural type | --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + ::: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | = note: `Vec<()>` is not usable in patterns | diff --git a/tests/ui/debuginfo/debuginfo-box-with-large-allocator.rs b/tests/ui/debuginfo/debuginfo-box-with-large-allocator.rs index ac857ff34a4d7..e5233c696c8a8 100644 --- a/tests/ui/debuginfo/debuginfo-box-with-large-allocator.rs +++ b/tests/ui/debuginfo/debuginfo-box-with-large-allocator.rs @@ -2,7 +2,7 @@ //@ compile-flags: -Cdebuginfo=2 // fixes issue #94725 -#![feature(allocator_api)] +#![feature(allocator_ext)] use std::alloc::{AllocError, Allocator, Layout}; use std::ptr::NonNull; diff --git a/tests/ui/drop/box-conditional-drop-allocator.rs b/tests/ui/drop/box-conditional-drop-allocator.rs index 8f78da16473e7..605969c58f0a0 100644 --- a/tests/ui/drop/box-conditional-drop-allocator.rs +++ b/tests/ui/drop/box-conditional-drop-allocator.rs @@ -1,5 +1,4 @@ //@ run-pass -#![feature(allocator_api)] // Regression test for #131082. // Testing that the allocator of a Box is dropped in conditional drops diff --git a/tests/ui/lifetimes/could-not-resolve-issue-121503.rs b/tests/ui/lifetimes/could-not-resolve-issue-121503.rs index 363162370f21b..6721fde174ef9 100644 --- a/tests/ui/lifetimes/could-not-resolve-issue-121503.rs +++ b/tests/ui/lifetimes/could-not-resolve-issue-121503.rs @@ -1,6 +1,6 @@ //@ edition:2018 -#![feature(allocator_api)] +#![feature(allocator_ext)] struct Struct; impl Struct { async fn box_ref_Struct(self: Box) -> &u32 { diff --git a/tests/ui/lint/must_not_suspend/allocator.rs b/tests/ui/lint/must_not_suspend/allocator.rs index c2ceb3297f37f..8c65c5889d987 100644 --- a/tests/ui/lint/must_not_suspend/allocator.rs +++ b/tests/ui/lint/must_not_suspend/allocator.rs @@ -1,6 +1,6 @@ //@ edition: 2021 -#![feature(must_not_suspend, allocator_api)] +#![feature(must_not_suspend, allocator_ext)] #![deny(must_not_suspend)] use std::alloc::*; diff --git a/tests/ui/lint/unused-features/used-library-features.rs b/tests/ui/lint/unused-features/used-library-features.rs index 1747c7741880e..5d18356febdc7 100644 --- a/tests/ui/lint/unused-features/used-library-features.rs +++ b/tests/ui/lint/unused-features/used-library-features.rs @@ -5,7 +5,7 @@ // Used library features #![feature(error_iter)] -#![cfg_attr(all(), feature(allocator_api))] +#![cfg_attr(all(), feature(allocator_ext))] pub fn use_error_iter(e: &(dyn std::error::Error + 'static)) { for _ in e.sources() {} @@ -13,5 +13,5 @@ pub fn use_error_iter(e: &(dyn std::error::Error + 'static)) { pub fn use_allocator_api() { use std::alloc::Global; - let _ = Vec::::new_in(Global); + let _ = Vec::::try_with_capacity_in(1, Global); } diff --git a/tests/ui/lto/issue-100772.rs b/tests/ui/lto/issue-100772.rs index e07d44e3be880..4452688c7187b 100644 --- a/tests/ui/lto/issue-100772.rs +++ b/tests/ui/lto/issue-100772.rs @@ -5,7 +5,7 @@ //@ only-x86_64-unknown-linux-gnu //@ ignore-backends: gcc -#![feature(allocator_api)] +#![feature(allocator_ext)] fn main() { let _ = Box::new_in(&[0, 1], &std::alloc::Global); diff --git a/tests/ui/pattern/deref-patterns/implicit-const-deref.stderr b/tests/ui/pattern/deref-patterns/implicit-const-deref.stderr index 7c176162ad184..c03137fcc4151 100644 --- a/tests/ui/pattern/deref-patterns/implicit-const-deref.stderr +++ b/tests/ui/pattern/deref-patterns/implicit-const-deref.stderr @@ -8,6 +8,7 @@ LL | EMPTY => {} | ^^^^^ constant of non-structural type | --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + ::: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | = note: `Vec<()>` is not usable in patterns | diff --git a/tests/ui/pattern/issue-115599.stderr b/tests/ui/pattern/issue-115599.stderr index f776623ff75b2..280516deba14b 100644 --- a/tests/ui/pattern/issue-115599.stderr +++ b/tests/ui/pattern/issue-115599.stderr @@ -8,6 +8,7 @@ LL | if let CONST_STRING = empty_str {} | ^^^^^^^^^^^^ constant of non-structural type | --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + ::: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | = note: `Vec` is not usable in patterns | diff --git a/tests/ui/pattern/pattern-tyvar-2.stderr b/tests/ui/pattern/pattern-tyvar-2.stderr index 6676d5129872b..4761a4e829b85 100644 --- a/tests/ui/pattern/pattern-tyvar-2.stderr +++ b/tests/ui/pattern/pattern-tyvar-2.stderr @@ -8,6 +8,7 @@ LL | fn foo(t: Bar) -> isize { match t { Bar::T1(_, Some(x)) => { return x * 3; | note: `Vec` does not implement `Mul<{integer}>` --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + ::: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | = note: `Vec` is defined in another crate diff --git a/tests/ui/precondition-checks/vec-from-parts.rs b/tests/ui/precondition-checks/vec-from-parts.rs index ace90770360e5..2b4c3edc8b4a6 100644 --- a/tests/ui/precondition-checks/vec-from-parts.rs +++ b/tests/ui/precondition-checks/vec-from-parts.rs @@ -1,7 +1,7 @@ //@ run-crash //@ compile-flags: -Cdebug-assertions=yes //@ error-pattern: unsafe precondition(s) violated: Vec::from_parts_in requires that length <= capacity -#![feature(allocator_api)] +#![feature(allocator_ext)] use std::ptr::NonNull; diff --git a/tests/ui/precondition-checks/vec-from-raw-parts.rs b/tests/ui/precondition-checks/vec-from-raw-parts.rs index 1bc8e6ada10d9..db883d2589754 100644 --- a/tests/ui/precondition-checks/vec-from-raw-parts.rs +++ b/tests/ui/precondition-checks/vec-from-raw-parts.rs @@ -3,7 +3,7 @@ //@ error-pattern: unsafe precondition(s) violated: Vec::from_raw_parts_in requires that length <= capacity //@ revisions: vec_from_raw_parts vec_from_raw_parts_in string_from_raw_parts -#![feature(allocator_api)] +#![feature(allocator_ext)] fn main() { let ptr = std::ptr::null_mut::(); diff --git a/tests/ui/regions/regions-mock-codegen.rs b/tests/ui/regions/regions-mock-codegen.rs index 99c863640669e..0677e0fabbf6d 100644 --- a/tests/ui/regions/regions-mock-codegen.rs +++ b/tests/ui/regions/regions-mock-codegen.rs @@ -1,7 +1,6 @@ //@ run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] -#![feature(allocator_api)] use std::alloc::{handle_alloc_error, Allocator, Global, Layout}; use std::ptr::NonNull; diff --git a/tests/ui/stability-attribute/suggest-vec-allocator-api.rs b/tests/ui/stability-attribute/suggest-vec-allocator-api.rs deleted file mode 100644 index 61a48c19e72ad..0000000000000 --- a/tests/ui/stability-attribute/suggest-vec-allocator-api.rs +++ /dev/null @@ -1,9 +0,0 @@ -fn main() { - let _: Vec = vec![]; //~ ERROR use of unstable library feature `allocator_api` - #[rustfmt::skip] - let _: Vec< - String, - _> = vec![]; //~ ERROR use of unstable library feature `allocator_api` - let _ = Vec::::new(); //~ ERROR use of unstable library feature `allocator_api` - let _boxed: Box = Box::new(10); //~ ERROR use of unstable library feature `allocator_api` -} diff --git a/tests/ui/stability-attribute/suggest-vec-allocator-api.stderr b/tests/ui/stability-attribute/suggest-vec-allocator-api.stderr deleted file mode 100644 index 78b7d07b60cc3..0000000000000 --- a/tests/ui/stability-attribute/suggest-vec-allocator-api.stderr +++ /dev/null @@ -1,53 +0,0 @@ -error[E0658]: use of unstable library feature `allocator_api` - --> $DIR/suggest-vec-allocator-api.rs:2:20 - | -LL | let _: Vec = vec![]; - | ----^ - | | - | help: consider wrapping the inner types in tuple: `(u8, _)` - | - = note: see issue #32838 for more information - = help: add `#![feature(allocator_api)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: use of unstable library feature `allocator_api` - --> $DIR/suggest-vec-allocator-api.rs:6:9 - | -LL | _> = vec![]; - | ^ - | - = note: see issue #32838 for more information - = help: add `#![feature(allocator_api)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -help: consider wrapping the inner types in tuple - | -LL ~ let _: Vec<( -LL + String, -LL ~ _)> = vec![]; - | - -error[E0658]: use of unstable library feature `allocator_api` - --> $DIR/suggest-vec-allocator-api.rs:7:24 - | -LL | let _ = Vec::::new(); - | -----^ - | | - | help: consider wrapping the inner types in tuple: `(u16, _)` - | - = note: see issue #32838 for more information - = help: add `#![feature(allocator_api)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: use of unstable library feature `allocator_api` - --> $DIR/suggest-vec-allocator-api.rs:8:26 - | -LL | let _boxed: Box = Box::new(10); - | ^ - | - = note: see issue #32838 for more information - = help: add `#![feature(allocator_api)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/traits/const-traits/issue-102156.rs b/tests/ui/traits/const-traits/issue-102156.rs index 506fdaa79c6f3..a6bd26eb2c8db 100644 --- a/tests/ui/traits/const-traits/issue-102156.rs +++ b/tests/ui/traits/const-traits/issue-102156.rs @@ -1,5 +1,5 @@ //@ edition:2015 -#![feature(allocator_api)] +#![feature(allocator_ext)] #![feature(const_trait_impl)] use core::convert::{From, TryFrom};