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.
This commit is contained in:
parent
cc4dd6fc9f
commit
2bb7e1e6ed
6 changed files with 12 additions and 6 deletions
|
@ -875,7 +875,8 @@ impl<T, A: Allocator> Vec<T, A> {
|
|||
/// in the given `Vec<T>`. 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
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue