From a1b93e8fed23825ce319b8bba8158e2f8d5d5335 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E6=9D=B0=E5=8F=8B=20Jieyou=20Xu=20=28Joe=29?= Date: Mon, 26 Feb 2024 19:22:34 +0000 Subject: [PATCH 1/4] Rearrange `Vec::from_raw_parts{,_in}` doc argument order to match code argument order --- library/alloc/src/vec/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index b59699219eb84..7e07a793a66df 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -481,7 +481,7 @@ impl Vec { Self::with_capacity_in(capacity, Global) } - /// Creates a `Vec` directly from a pointer, a capacity, and a length. + /// Creates a `Vec` directly from a pointer, a length, and a capacity. /// /// # Safety /// @@ -672,7 +672,7 @@ impl Vec { Vec { buf: RawVec::with_capacity_in(capacity, alloc), len: 0 } } - /// Creates a `Vec` directly from a pointer, a capacity, a length, + /// Creates a `Vec` directly from a pointer, a length, a capacity, /// and an allocator. /// /// # Safety From 26bdf2900acad2091ab7e59296d3a457011ea770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E6=9D=B0=E5=8F=8B=20Jieyou=20Xu=20=28Joe=29?= Date: Mon, 26 Feb 2024 19:24:49 +0000 Subject: [PATCH 2/4] Rearrange `String::from_raw_parts` doc argument order to match code argument order --- library/alloc/src/string.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs index 6dadbc8e36428..955438f49a103 100644 --- a/library/alloc/src/string.rs +++ b/library/alloc/src/string.rs @@ -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 /// From dd24a462d517cf2a0667adf92aaa38502b71b61c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E6=9D=B0=E5=8F=8B=20Jieyou=20Xu=20=28Joe=29?= Date: Mon, 26 Feb 2024 19:26:49 +0000 Subject: [PATCH 3/4] Document args returned from `Vec::into_raw_parts{,_with_alloc}` --- library/alloc/src/vec/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index 7e07a793a66df..7bd19875584a3 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -786,7 +786,7 @@ impl Vec { unsafe { Vec { buf: RawVec::from_raw_parts_in(ptr, capacity, alloc), len: length } } } - /// Decomposes a `Vec` into its raw components. + /// Decomposes a `Vec` 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 @@ -824,7 +824,7 @@ impl Vec { (me.as_mut_ptr(), me.len(), me.capacity()) } - /// Decomposes a `Vec` into its raw components. + /// Decomposes a `Vec` 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 From bfeea294cc01c295ca5b54dcbfb59ee6953b4fc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E6=9D=B0=E5=8F=8B=20Jieyou=20Xu=20=28Joe=29?= Date: Mon, 26 Feb 2024 19:31:51 +0000 Subject: [PATCH 4/4] Document args returned from `String::into_raw_parts` --- library/alloc/src/string.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs index 955438f49a103..1d3c04f7807ab 100644 --- a/library/alloc/src/string.rs +++ b/library/alloc/src/string.rs @@ -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