Skip to content

Commit ed4bb09

Browse files
authored
Rollup merge of rust-lang#121648 - jieyouxu:from-into-raw-parts-docs, r=Nilstrieb
Update Vec and String `{from,into}_raw_parts`-family docs - Fix documentation argument order to match the code argument order for consistency. - Add return argument description for `{Vec,String}::into_raw_parts` to match their `from*` counterparts.
2 parents 50b156d + deb2e44 commit ed4bb09

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

alloc/src/string.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ impl String {
864864
}
865865
}
866866

867-
/// Decomposes a `String` into its raw components.
867+
/// Decomposes a `String` into its raw components: `(pointer, length, capacity)`.
868868
///
869869
/// Returns the raw pointer to the underlying data, the length of
870870
/// the string (in bytes), and the allocated capacity of the data
@@ -896,7 +896,7 @@ impl String {
896896
self.vec.into_raw_parts()
897897
}
898898

899-
/// Creates a new `String` from a length, capacity, and pointer.
899+
/// Creates a new `String` from a pointer, a length and a capacity.
900900
///
901901
/// # Safety
902902
///

alloc/src/vec/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ impl<T> Vec<T> {
481481
Self::with_capacity_in(capacity, Global)
482482
}
483483

484-
/// Creates a `Vec<T>` directly from a pointer, a capacity, and a length.
484+
/// Creates a `Vec<T>` directly from a pointer, a length, and a capacity.
485485
///
486486
/// # Safety
487487
///
@@ -672,7 +672,7 @@ impl<T, A: Allocator> Vec<T, A> {
672672
Vec { buf: RawVec::with_capacity_in(capacity, alloc), len: 0 }
673673
}
674674

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

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

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

0 commit comments

Comments
 (0)