Skip to content

Commit 77606f2

Browse files
committed
Stabilize alloc::Layout (with only some of its methods)
1 parent 75e17da commit 77606f2

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/libcore/alloc.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fn size_align<T>() -> (usize, usize) {
4646
/// requests have positive size. A caller to the `Alloc::alloc`
4747
/// method must either ensure that conditions like this are met, or
4848
/// use specific allocators with looser requirements.)
49-
#[unstable(feature = "allocator_api", issue = "32838")]
49+
#[stable(feature = "alloc_layout", since = "1.28.0")]
5050
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
5151
pub struct Layout {
5252
// size of the requested block of memory, measured in bytes.
@@ -72,7 +72,7 @@ impl Layout {
7272
/// * `size`, when rounded up to the nearest multiple of `align`,
7373
/// must not overflow (i.e. the rounded value must be less than
7474
/// `usize::MAX`).
75-
#[unstable(feature = "allocator_api", issue = "32838")]
75+
#[stable(feature = "alloc_layout", since = "1.28.0")]
7676
#[inline]
7777
pub fn from_size_align(size: usize, align: usize) -> Result<Self, LayoutErr> {
7878
if !align.is_power_of_two() {
@@ -108,24 +108,24 @@ impl Layout {
108108
///
109109
/// This function is unsafe as it does not verify the preconditions from
110110
/// [`Layout::from_size_align`](#method.from_size_align).
111-
#[unstable(feature = "allocator_api", issue = "32838")]
111+
#[stable(feature = "alloc_layout", since = "1.28.0")]
112112
#[inline]
113113
pub unsafe fn from_size_align_unchecked(size: usize, align: usize) -> Self {
114114
Layout { size_: size, align_: NonZeroUsize::new_unchecked(align) }
115115
}
116116

117117
/// The minimum size in bytes for a memory block of this layout.
118-
#[unstable(feature = "allocator_api", issue = "32838")]
118+
#[stable(feature = "alloc_layout", since = "1.28.0")]
119119
#[inline]
120120
pub fn size(&self) -> usize { self.size_ }
121121

122122
/// The minimum byte alignment for a memory block of this layout.
123-
#[unstable(feature = "allocator_api", issue = "32838")]
123+
#[stable(feature = "alloc_layout", since = "1.28.0")]
124124
#[inline]
125125
pub fn align(&self) -> usize { self.align_.get() }
126126

127127
/// Constructs a `Layout` suitable for holding a value of type `T`.
128-
#[unstable(feature = "allocator_api", issue = "32838")]
128+
#[stable(feature = "alloc_layout", since = "1.28.0")]
129129
#[inline]
130130
pub fn new<T>() -> Self {
131131
let (size, align) = size_align::<T>();
@@ -142,7 +142,7 @@ impl Layout {
142142
/// Produces layout describing a record that could be used to
143143
/// allocate backing structure for `T` (which could be a trait
144144
/// or other unsized type like a slice).
145-
#[unstable(feature = "allocator_api", issue = "32838")]
145+
#[stable(feature = "alloc_layout", since = "1.28.0")]
146146
#[inline]
147147
pub fn for_value<T: ?Sized>(t: &T) -> Self {
148148
let (size, align) = (mem::size_of_val(t), mem::align_of_val(t));
@@ -331,14 +331,14 @@ impl Layout {
331331
/// The parameters given to `Layout::from_size_align`
332332
/// or some other `Layout` constructor
333333
/// do not satisfy its documented constraints.
334-
#[unstable(feature = "allocator_api", issue = "32838")]
334+
#[stable(feature = "alloc_layout", since = "1.28.0")]
335335
#[derive(Clone, PartialEq, Eq, Debug)]
336336
pub struct LayoutErr {
337337
private: ()
338338
}
339339

340340
// (we need this for downstream impl of trait Error)
341-
#[unstable(feature = "allocator_api", issue = "32838")]
341+
#[stable(feature = "alloc_layout", since = "1.28.0")]
342342
impl fmt::Display for LayoutErr {
343343
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
344344
f.write_str("invalid parameters to Layout::from_size_align")

0 commit comments

Comments
 (0)