about summary refs log tree commit diff
path: root/library/std/src/sys_common
diff options
context:
space:
mode:
authorYOSHIOKA Takuma <nop_thread@nops.red>2022-08-10 01:51:38 +0900
committerYOSHIOKA Takuma <nop_thread@nops.red>2022-08-10 01:51:38 +0900
commit2bb7e1e6edf58c39faabb67cfab63dd8109d8055 (patch)
tree23f38608220364faa9a7b8887c70ca10d3cec27c /library/std/src/sys_common
parentcc4dd6fc9f1a5c798df269933c7e442b79661a86 (diff)
downloadrust-2bb7e1e6edf58c39faabb67cfab63dd8109d8055.tar.gz
rust-2bb7e1e6edf58c39faabb67cfab63dd8109d8055.zip
Guarantee `try_reserve` preserves the contents on error
Update doc comments to make the guarantee explicit. However, some
implementations does not have the statement though.

* `HashMap`, `HashSet`: require guarantees on hashbrown side.
* `PathBuf`: simply redirecting to `OsString`.

Fixes #99606.
Diffstat (limited to 'library/std/src/sys_common')
-rw-r--r--library/std/src/sys_common/wtf8.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/library/std/src/sys_common/wtf8.rs b/library/std/src/sys_common/wtf8.rs
index 57fa4989358..33e20756163 100644
--- a/library/std/src/sys_common/wtf8.rs
+++ b/library/std/src/sys_common/wtf8.rs
@@ -236,7 +236,8 @@ impl Wtf8Buf {
     /// in the given `Wtf8Buf`. The `Wtf8Buf` may reserve more space to avoid
     /// frequent reallocations. After calling `try_reserve`, capacity will be
     /// greater than or equal to `self.len() + additional`. Does nothing if
-    /// capacity is already sufficient.
+    /// capacity is already sufficient. This method preserves the contents even
+    /// if an error occurs.
     ///
     /// # Errors
     ///