Skip to content

Commit

Permalink
Add information about allocation lifetime to Allocator::allocate
Browse files Browse the repository at this point in the history
  • Loading branch information
Amanieu committed Feb 13, 2024
1 parent fb5ed29 commit 8e9c8dd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions library/core/src/alloc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ pub unsafe trait Allocator {
/// The returned block may have a larger size than specified by `layout.size()`, and may or may
/// not have its contents initialized.
///
/// The returned block of memory remains valid as long as it is [*currently allocated*] and the shorter of:
/// - the borrow-checker lifetime of the allocator type itself.
/// - as long as at the allocator and all its clones has not been dropped.
///
/// # Errors
///
/// Returning `Err` indicates that either memory is exhausted or `layout` does not meet
Expand Down

0 comments on commit 8e9c8dd

Please sign in to comment.