@@ -46,7 +46,7 @@ fn size_align<T>() -> (usize, usize) {
46
46
/// requests have positive size. A caller to the `Alloc::alloc`
47
47
/// method must either ensure that conditions like this are met, or
48
48
/// use specific allocators with looser requirements.)
49
- #[ unstable ( feature = "allocator_api " , issue = "32838 " ) ]
49
+ #[ stable ( feature = "alloc_layout " , since = "1.28.0 " ) ]
50
50
#[ derive( Copy , Clone , Debug , PartialEq , Eq ) ]
51
51
pub struct Layout {
52
52
// size of the requested block of memory, measured in bytes.
@@ -72,7 +72,7 @@ impl Layout {
72
72
/// * `size`, when rounded up to the nearest multiple of `align`,
73
73
/// must not overflow (i.e. the rounded value must be less than
74
74
/// `usize::MAX`).
75
- #[ unstable ( feature = "allocator_api " , issue = "32838 " ) ]
75
+ #[ stable ( feature = "alloc_layout " , since = "1.28.0 " ) ]
76
76
#[ inline]
77
77
pub fn from_size_align ( size : usize , align : usize ) -> Result < Self , LayoutErr > {
78
78
if !align. is_power_of_two ( ) {
@@ -108,24 +108,24 @@ impl Layout {
108
108
///
109
109
/// This function is unsafe as it does not verify the preconditions from
110
110
/// [`Layout::from_size_align`](#method.from_size_align).
111
- #[ unstable ( feature = "allocator_api " , issue = "32838 " ) ]
111
+ #[ stable ( feature = "alloc_layout " , since = "1.28.0 " ) ]
112
112
#[ inline]
113
113
pub unsafe fn from_size_align_unchecked ( size : usize , align : usize ) -> Self {
114
114
Layout { size_ : size, align_ : NonZeroUsize :: new_unchecked ( align) }
115
115
}
116
116
117
117
/// 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 " ) ]
119
119
#[ inline]
120
120
pub fn size ( & self ) -> usize { self . size_ }
121
121
122
122
/// 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 " ) ]
124
124
#[ inline]
125
125
pub fn align ( & self ) -> usize { self . align_ . get ( ) }
126
126
127
127
/// 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 " ) ]
129
129
#[ inline]
130
130
pub fn new < T > ( ) -> Self {
131
131
let ( size, align) = size_align :: < T > ( ) ;
@@ -142,7 +142,7 @@ impl Layout {
142
142
/// Produces layout describing a record that could be used to
143
143
/// allocate backing structure for `T` (which could be a trait
144
144
/// or other unsized type like a slice).
145
- #[ unstable ( feature = "allocator_api " , issue = "32838 " ) ]
145
+ #[ stable ( feature = "alloc_layout " , since = "1.28.0 " ) ]
146
146
#[ inline]
147
147
pub fn for_value < T : ?Sized > ( t : & T ) -> Self {
148
148
let ( size, align) = ( mem:: size_of_val ( t) , mem:: align_of_val ( t) ) ;
@@ -331,14 +331,14 @@ impl Layout {
331
331
/// The parameters given to `Layout::from_size_align`
332
332
/// or some other `Layout` constructor
333
333
/// do not satisfy its documented constraints.
334
- #[ unstable ( feature = "allocator_api " , issue = "32838 " ) ]
334
+ #[ stable ( feature = "alloc_layout " , since = "1.28.0 " ) ]
335
335
#[ derive( Clone , PartialEq , Eq , Debug ) ]
336
336
pub struct LayoutErr {
337
337
private : ( )
338
338
}
339
339
340
340
// (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 " ) ]
342
342
impl fmt:: Display for LayoutErr {
343
343
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
344
344
f. write_str ( "invalid parameters to Layout::from_size_align" )
0 commit comments