-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Guarantees of content preservation on try_reserve
failure?
#99606
Comments
At least for I think it'll need to be added to hashbrown before we can consider promising it for |
Modulo needing to add it in hashbrown, shall we see if we have consensus to say that @rfcbot merge |
Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
Please feel free to post a PR for this. |
Created a PR #100331 for this. |
…ilure, 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 rust-lang#99606.
…ilure, 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 rust-lang#99606.
Location
Any
try_reserve
methods of container types (12 in Rust 1,62.1, including duplicated ones inalloc
), and maybe correspondingtry_reserve_exact
methods.std::collections::BinaryHeap::try_reserve[_exact]
std::collections::VecDeque::try_reserve[_exact]
std::collections::HashMap::try_reserve
std::collections::HashSet::try_reserve
std::ffi::OsString::try_reserve[_exact]
std::path::PathBuf::try_reserve[_exact]
std::string::String::try_reserve[_exact]
std::vec::Vec::try_reserve[_exact]
alloc
.Summary
Documentations for
try_reserve
describes "If the capacity overflows, or the allocator reports a failure, then an error is returned.".However, it does not give any guarantees about whether the content is preserved or not on that error.
This guarantee (or absence of the guarantee) should be explicitly described.
The text was updated successfully, but these errors were encountered: