From 176b96516fed01dbf858b1b9d342dd2e3aa48a37 Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Thu, 8 Oct 2020 23:39:31 +0800 Subject: [PATCH 1/3] Link Vec leak doc to Box --- library/alloc/src/vec.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/alloc/src/vec.rs b/library/alloc/src/vec.rs index e8e52299d0b70..3f4a97df08d38 100644 --- a/library/alloc/src/vec.rs +++ b/library/alloc/src/vec.rs @@ -1476,7 +1476,7 @@ impl Vec { /// `'a`. If the type has only static references, or none at all, then this /// may be chosen to be `'static`. /// - /// This function is similar to the `leak` function on `Box`. + /// This function is similar to the [`leak`][Box::leak] function on [`Box`]. /// /// This function is mainly useful for data that lives for the remainder of /// the program's life. Dropping the returned reference will cause a memory From 66369a6c70d470872f0a64633e71d91e5385a6c6 Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Sat, 10 Oct 2020 22:12:28 +0800 Subject: [PATCH 2/3] Alloc vec doc mention cannot undo leak --- library/alloc/src/vec.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/alloc/src/vec.rs b/library/alloc/src/vec.rs index 3f4a97df08d38..fb43f21446128 100644 --- a/library/alloc/src/vec.rs +++ b/library/alloc/src/vec.rs @@ -1476,7 +1476,8 @@ impl Vec { /// `'a`. If the type has only static references, or none at all, then this /// may be chosen to be `'static`. /// - /// This function is similar to the [`leak`][Box::leak] function on [`Box`]. + /// This function is similar to the [`leak`][Box::leak] function on [`Box`] + /// except there are no way to undo the leak yet. /// /// This function is mainly useful for data that lives for the remainder of /// the program's life. Dropping the returned reference will cause a memory From 8688fa825016f3bcf320b1e9b499616e13bb64d2 Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Sat, 10 Oct 2020 22:17:48 +0800 Subject: [PATCH 3/3] Improve vec leak wording Co-authored-by: Joshua Nelson --- library/alloc/src/vec.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/alloc/src/vec.rs b/library/alloc/src/vec.rs index fb43f21446128..5e68f76693fcf 100644 --- a/library/alloc/src/vec.rs +++ b/library/alloc/src/vec.rs @@ -1477,7 +1477,7 @@ impl Vec { /// may be chosen to be `'static`. /// /// This function is similar to the [`leak`][Box::leak] function on [`Box`] - /// except there are no way to undo the leak yet. + /// except that there is no way to recover the leaked memory. /// /// This function is mainly useful for data that lives for the remainder of /// the program's life. Dropping the returned reference will cause a memory