From 77606f20c92518c16d68bf16c0a117af1e925524 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Thu, 31 May 2018 19:10:08 +0200 Subject: [PATCH] Stabilize alloc::Layout (with only some of its methods) --- src/libcore/alloc.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/libcore/alloc.rs b/src/libcore/alloc.rs index 97ad55304be79..a65a06d0c8933 100644 --- a/src/libcore/alloc.rs +++ b/src/libcore/alloc.rs @@ -46,7 +46,7 @@ fn size_align() -> (usize, usize) { /// requests have positive size. A caller to the `Alloc::alloc` /// method must either ensure that conditions like this are met, or /// use specific allocators with looser requirements.) -#[unstable(feature = "allocator_api", issue = "32838")] +#[stable(feature = "alloc_layout", since = "1.28.0")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub struct Layout { // size of the requested block of memory, measured in bytes. @@ -72,7 +72,7 @@ impl Layout { /// * `size`, when rounded up to the nearest multiple of `align`, /// must not overflow (i.e. the rounded value must be less than /// `usize::MAX`). - #[unstable(feature = "allocator_api", issue = "32838")] + #[stable(feature = "alloc_layout", since = "1.28.0")] #[inline] pub fn from_size_align(size: usize, align: usize) -> Result { if !align.is_power_of_two() { @@ -108,24 +108,24 @@ impl Layout { /// /// This function is unsafe as it does not verify the preconditions from /// [`Layout::from_size_align`](#method.from_size_align). - #[unstable(feature = "allocator_api", issue = "32838")] + #[stable(feature = "alloc_layout", since = "1.28.0")] #[inline] pub unsafe fn from_size_align_unchecked(size: usize, align: usize) -> Self { Layout { size_: size, align_: NonZeroUsize::new_unchecked(align) } } /// The minimum size in bytes for a memory block of this layout. - #[unstable(feature = "allocator_api", issue = "32838")] + #[stable(feature = "alloc_layout", since = "1.28.0")] #[inline] pub fn size(&self) -> usize { self.size_ } /// The minimum byte alignment for a memory block of this layout. - #[unstable(feature = "allocator_api", issue = "32838")] + #[stable(feature = "alloc_layout", since = "1.28.0")] #[inline] pub fn align(&self) -> usize { self.align_.get() } /// Constructs a `Layout` suitable for holding a value of type `T`. - #[unstable(feature = "allocator_api", issue = "32838")] + #[stable(feature = "alloc_layout", since = "1.28.0")] #[inline] pub fn new() -> Self { let (size, align) = size_align::(); @@ -142,7 +142,7 @@ impl Layout { /// Produces layout describing a record that could be used to /// allocate backing structure for `T` (which could be a trait /// or other unsized type like a slice). - #[unstable(feature = "allocator_api", issue = "32838")] + #[stable(feature = "alloc_layout", since = "1.28.0")] #[inline] pub fn for_value(t: &T) -> Self { let (size, align) = (mem::size_of_val(t), mem::align_of_val(t)); @@ -331,14 +331,14 @@ impl Layout { /// The parameters given to `Layout::from_size_align` /// or some other `Layout` constructor /// do not satisfy its documented constraints. -#[unstable(feature = "allocator_api", issue = "32838")] +#[stable(feature = "alloc_layout", since = "1.28.0")] #[derive(Clone, PartialEq, Eq, Debug)] pub struct LayoutErr { private: () } // (we need this for downstream impl of trait Error) -#[unstable(feature = "allocator_api", issue = "32838")] +#[stable(feature = "alloc_layout", since = "1.28.0")] impl fmt::Display for LayoutErr { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("invalid parameters to Layout::from_size_align")