diff options
| author | Simon Sapin <simon.sapin@exyr.org> | 2018-05-31 19:10:08 +0200 |
|---|---|---|
| committer | Simon Sapin <simon.sapin@exyr.org> | 2018-06-11 13:48:33 -0700 |
| commit | 77606f20c92518c16d68bf16c0a117af1e925524 (patch) | |
| tree | 9fcdd22d19629d5431354c07b102c7c5128f9892 | |
| parent | 75e17da87358751becc950b9319f5d4aa82744ce (diff) | |
| download | rust-77606f20c92518c16d68bf16c0a117af1e925524.tar.gz rust-77606f20c92518c16d68bf16c0a117af1e925524.zip | |
Stabilize alloc::Layout (with only some of its methods)
| -rw-r--r-- | src/libcore/alloc.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/libcore/alloc.rs b/src/libcore/alloc.rs index 97ad55304be..a65a06d0c89 100644 --- a/src/libcore/alloc.rs +++ b/src/libcore/alloc.rs @@ -46,7 +46,7 @@ fn size_align<T>() -> (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<Self, LayoutErr> { 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<T>() -> Self { let (size, align) = size_align::<T>(); @@ -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: ?Sized>(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") |
