diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-08-22 20:34:12 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-22 20:34:12 +0530 |
| commit | 382ba73062e6ea48dbdd3fab623d4c530ea9a476 (patch) | |
| tree | e00d640851fa41eb78d7732eec15d14db06a5d6b /library/alloc/src/collections/vec_deque | |
| parent | c1a5ec7faf6c32af2f0aae1af4420e1bb1a3a7fe (diff) | |
| parent | 2bb7e1e6edf58c39faabb67cfab63dd8109d8055 (diff) | |
Rollup merge of #100331 - lo48576:try-reserve-preserve-on-failure, r=thomcc
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/alloc/src/collections/vec_deque')
| -rw-r--r-- | library/alloc/src/collections/vec_deque/mod.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/library/alloc/src/collections/vec_deque/mod.rs b/library/alloc/src/collections/vec_deque/mod.rs index 57ab74e0159..347a938fd0c 100644 --- a/library/alloc/src/collections/vec_deque/mod.rs +++ b/library/alloc/src/collections/vec_deque/mod.rs @@ -794,7 +794,8 @@ impl<T, A: Allocator> VecDeque<T, A> { /// in the given deque. The collection may reserve more space to speculatively avoid /// frequent reallocations. After calling `try_reserve`, capacity will be /// greater than or equal to `self.len() + additional` if it returns - /// `Ok(())`. Does nothing if capacity is already sufficient. + /// `Ok(())`. Does nothing if capacity is already sufficient. This method + /// preserves the contents even if an error occurs. /// /// # Errors /// |
