Skip to content

Commit 929e37d

Browse files
committed
Revert renaming of "memory block"
1 parent ab9362a commit 929e37d

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

library/core/src/alloc/mod.rs

+22-22
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ impl fmt::Display for AllocErr {
4242
///
4343
/// ### Currently allocated memory
4444
///
45-
/// Some of the methods require that a memory slice be *currently allocated* via an allocator. This
45+
/// Some of the methods require that a memory block be *currently allocated* via an allocator. This
4646
/// means that:
4747
///
48-
/// * the starting address for that memory slice was previously returned by [`alloc`], [`grow`], or
48+
/// * the starting address for that memory block was previously returned by [`alloc`], [`grow`], or
4949
/// [`shrink`], and
5050
///
51-
/// * the memory slice has not been subsequently deallocated, where slices are either deallocated
51+
/// * the memory block has not been subsequently deallocated, where blocks are either deallocated
5252
/// directly by being passed to [`dealloc`] or were changed by being passed to [`grow`] or
5353
/// [`shrink`] that returns `Ok`. If `grow` or `shrink` have returned `Err`, the passed pointer
5454
/// remains valid.
@@ -60,38 +60,38 @@ impl fmt::Display for AllocErr {
6060
///
6161
/// ### Memory fitting
6262
///
63-
/// Some of the methods require that a layout *fit* a memory slice. What it means for a layout to
64-
/// "fit" a memory slice means (or equivalently, for a memory slice to "fit" a layout) is that the
63+
/// Some of the methods require that a layout *fit* a memory block. What it means for a layout to
64+
/// "fit" a memory block means (or equivalently, for a memory block to "fit" a layout) is that the
6565
/// following conditions must hold:
6666
///
67-
/// * The slice must be allocated with the same alignment as [`layout.align()`], and
67+
/// * The block must be allocated with the same alignment as [`layout.align()`], and
6868
///
6969
/// * The provided [`layout.size()`] must fall in the range `min ..= max`, where:
70-
/// - `min` is the size of the layout most recently used to allocate the slice, and
70+
/// - `min` is the size of the layout most recently used to allocate the block, and
7171
/// - `max` is the latest actual size returned from [`alloc`], [`grow`], or [`shrink`].
7272
///
7373
/// [`layout.align()`]: Layout::align
7474
/// [`layout.size()`]: Layout::size
7575
///
7676
/// # Safety
7777
///
78-
/// * Memory slices returned from an allocator must point to valid memory and retain their validity
78+
/// * Memory blocks returned from an allocator must point to valid memory and retain their validity
7979
/// until the instance and all of its clones are dropped,
8080
///
81-
/// * cloning or moving the allocator must not invalidate memory slices returned from this
81+
/// * cloning or moving the allocator must not invalidate memory blocks returned from this
8282
/// allocator. A cloned allocator must behave like the same allocator, and
8383
///
84-
/// * any pointer to a memory slice which is [*currently allocated*] may be passed to any other
84+
/// * any pointer to a memory block which is [*currently allocated*] may be passed to any other
8585
/// method of the allocator.
8686
///
8787
/// [*currently allocated*]: #currently-allocated-memory
8888
#[unstable(feature = "allocator_api", issue = "32838")]
8989
pub unsafe trait AllocRef {
90-
/// Attempts to allocate a slice of memory.
90+
/// Attempts to allocate a block of memory.
9191
///
9292
/// On success, returns a [`NonNull<[u8]>`] meeting the size and alignment guarantees of `layout`.
9393
///
94-
/// The returned slice may have a larger size than specified by `layout.size()`, and may or may
94+
/// The returned block may have a larger size than specified by `layout.size()`, and may or may
9595
/// not have its contents initialized.
9696
///
9797
/// [`NonNull<[u8]>`]: NonNull
@@ -133,18 +133,18 @@ pub unsafe trait AllocRef {
133133
Ok(ptr)
134134
}
135135

136-
/// Deallocates the memory slice referenced by `ptr`.
136+
/// Deallocates the memory referenced by `ptr`.
137137
///
138138
/// # Safety
139139
///
140-
/// * `ptr` must denote a slice of memory [*currently allocated*] via this allocator, and
141-
/// * `layout` must [*fit*] that slice of memory.
140+
/// * `ptr` must denote a block of memory [*currently allocated*] via this allocator, and
141+
/// * `layout` must [*fit*] that block of memory.
142142
///
143143
/// [*currently allocated*]: #currently-allocated-memory
144144
/// [*fit*]: #memory-fitting
145145
unsafe fn dealloc(&mut self, ptr: NonNull<u8>, layout: Layout);
146146

147-
/// Attempts to extend the memory slice.
147+
/// Attempts to extend the memory block.
148148
///
149149
/// Returns a new [`NonNull<[u8]>`] containing a pointer and the actual size of the allocated
150150
/// memory. The pointer is suitable for holding data described by a new layout with `layout`’s
@@ -293,27 +293,27 @@ pub unsafe trait AllocRef {
293293
}
294294
}
295295

296-
/// Attempts to shrink the memory slice.
296+
/// Attempts to shrink the memory block.
297297
///
298298
/// Returns a new [`NonNull<[u8]>`] containing a pointer and the actual size of the allocated
299299
/// memory. The pointer is suitable for holding data described by a new layout with `layout`’s
300300
/// alignment and a size given by `new_size`. To accomplish this, the allocator may shrink the
301301
/// allocation referenced by `ptr` to fit the new layout.
302302
///
303-
/// If this returns `Ok`, then ownership of the memory slice referenced by `ptr` has been
303+
/// If this returns `Ok`, then ownership of the memory block referenced by `ptr` has been
304304
/// transferred to this allocator. The memory may or may not have been freed, and should be
305305
/// considered unusable unless it was transferred back to the caller again via the
306306
/// return value of this method.
307307
///
308-
/// If this method returns `Err`, then ownership of the memory slice has not been transferred to
309-
/// this allocator, and the contents of the memory slice are unaltered.
308+
/// If this method returns `Err`, then ownership of the memory block has not been transferred to
309+
/// this allocator, and the contents of the memory block are unaltered.
310310
///
311311
/// [`NonNull<[u8]>`]: NonNull
312312
///
313313
/// # Safety
314314
///
315-
/// * `ptr` must denote a slice of memory [*currently allocated*] via this allocator,
316-
/// * `layout` must [*fit*] that slice of memory (The `new_size` argument need not fit it.), and
315+
/// * `ptr` must denote a block of memory [*currently allocated*] via this allocator,
316+
/// * `layout` must [*fit*] that block of memory (The `new_size` argument need not fit it.), and
317317
/// * `new_size` must be smaller than or equal to `layout.size()`.
318318
// Note: We can't require that `new_size` is strictly smaller than `layout.size()` because of ZSTs.
319319
// alternative: `new_size` must be smaller than `layout.size()` or both are zero

0 commit comments

Comments
 (0)