@@ -33,9 +33,7 @@ impl fmt::Display for AllocErr {
33
33
#[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
34
34
#[ unstable( feature = "allocator_api" , issue = "32838" ) ]
35
35
pub enum AllocInit {
36
- /// The contents of the new memory are undefined.
37
- ///
38
- /// Reading uninitialized memory is Undefined Behavior; it must be initialized before use.
36
+ /// The contents of the new memory are uninitialized.
39
37
Uninitialized ,
40
38
/// The new memory is guaranteed to be zeroed.
41
39
Zeroed ,
@@ -196,7 +194,11 @@ pub unsafe trait AllocRef {
196
194
///
197
195
/// # Safety
198
196
///
199
- /// `memory` must be a memory block returned by this allocator.
197
+ /// * `ptr` must be [*currently allocated*] via this allocator, and
198
+ /// * `layout` must [*fit*] the `ptr`.
199
+ ///
200
+ /// [*currently allocated*]: #currently-allocated-memory
201
+ /// [*fit*]: #memory-fitting
200
202
unsafe fn dealloc ( & mut self , ptr : NonNull < u8 > , layout : Layout ) ;
201
203
202
204
/// Attempts to extend the memory block.
@@ -237,7 +239,7 @@ pub unsafe trait AllocRef {
237
239
// * `new_size must be strictly greater than `memory.size` or both are zero
238
240
/// * `new_size` must be greater than or equal to `layout.size()`
239
241
/// * `new_size`, when rounded up to the nearest multiple of `layout.align()`, must not overflow
240
- /// (i.e., the rounded value must be less than `usize::MAX`).
242
+ /// (i.e., the rounded value must be less than or equal to `usize::MAX`).
241
243
///
242
244
/// [*currently allocated*]: #currently-allocated-memory
243
245
/// [*fit*]: #memory-fitting
0 commit comments