1
Fork 0

Consistent variable name alloc for raw_vec

This commit is contained in:
Ivan Tham 2020-08-04 23:46:14 +08:00 committed by GitHub
parent 5f6bd6ec0a
commit e1ef3fa686
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -203,13 +203,15 @@ impl<T, A: AllocRef> RawVec<T, A> {
/// ///
/// # Safety /// # Safety
/// ///
/// The `ptr` must be allocated (via the given allocator `a`), and with the given `capacity`. /// The `ptr` must be allocated (via the given allocator `alloc`), and with the given
/// `capacity`.
/// The `capacity` cannot exceed `isize::MAX` for sized types. (only a concern on 32-bit /// The `capacity` cannot exceed `isize::MAX` for sized types. (only a concern on 32-bit
/// systems). ZST vectors may have a capacity up to `usize::MAX`. /// systems). ZST vectors may have a capacity up to `usize::MAX`.
/// If the `ptr` and `capacity` come from a `RawVec` created via `a`, then this is guaranteed. /// If the `ptr` and `capacity` come from a `RawVec` created via `alloc`, then this is
/// guaranteed.
#[inline] #[inline]
pub unsafe fn from_raw_parts_in(ptr: *mut T, capacity: usize, a: A) -> Self { pub unsafe fn from_raw_parts_in(ptr: *mut T, capacity: usize, alloc: A) -> Self {
Self { ptr: unsafe { Unique::new_unchecked(ptr) }, cap: capacity, alloc: a } Self { ptr: unsafe { Unique::new_unchecked(ptr) }, cap: capacity, alloc }
} }
/// Gets a raw pointer to the start of the allocation. Note that this is /// Gets a raw pointer to the start of the allocation. Note that this is