Skip to content

Update Vec and String {from,into}_raw_parts-family docs #121648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions library/alloc/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ impl String {
}
}

/// Decomposes a `String` into its raw components.
/// Decomposes a `String` into its raw components: `(pointer, length, capacity)`.
///
/// Returns the raw pointer to the underlying data, the length of
/// the string (in bytes), and the allocated capacity of the data
Expand Down Expand Up @@ -896,7 +896,7 @@ impl String {
self.vec.into_raw_parts()
}

/// Creates a new `String` from a length, capacity, and pointer.
/// Creates a new `String` from a pointer, a length and a capacity.
///
/// # Safety
///
Expand Down
8 changes: 4 additions & 4 deletions library/alloc/src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ impl<T> Vec<T> {
Self::with_capacity_in(capacity, Global)
}

/// Creates a `Vec<T>` directly from a pointer, a capacity, and a length.
/// Creates a `Vec<T>` directly from a pointer, a length, and a capacity.
///
/// # Safety
///
Expand Down Expand Up @@ -672,7 +672,7 @@ impl<T, A: Allocator> Vec<T, A> {
Vec { buf: RawVec::with_capacity_in(capacity, alloc), len: 0 }
}

/// Creates a `Vec<T, A>` directly from a pointer, a capacity, a length,
/// Creates a `Vec<T, A>` directly from a pointer, a length, a capacity,
/// and an allocator.
///
/// # Safety
Expand Down Expand Up @@ -786,7 +786,7 @@ impl<T, A: Allocator> Vec<T, A> {
unsafe { Vec { buf: RawVec::from_raw_parts_in(ptr, capacity, alloc), len: length } }
}

/// Decomposes a `Vec<T>` into its raw components.
/// Decomposes a `Vec<T>` into its raw components: `(pointer, length, capacity)`.
///
/// Returns the raw pointer to the underlying data, the length of
/// the vector (in elements), and the allocated capacity of the
Expand Down Expand Up @@ -824,7 +824,7 @@ impl<T, A: Allocator> Vec<T, A> {
(me.as_mut_ptr(), me.len(), me.capacity())
}

/// Decomposes a `Vec<T>` into its raw components.
/// Decomposes a `Vec<T>` into its raw components: `(pointer, length, capacity, allocator)`.
///
/// Returns the raw pointer to the underlying data, the length of the vector (in elements),
/// the allocated capacity of the data (in elements), and the allocator. These are the same
Expand Down