-
-
Notifications
You must be signed in to change notification settings - Fork 15k
Guarantees of content preservation on try_reserve failure? #99606
Copy link
Copy link
Closed
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.
Metadata
Metadata
Assignees
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Location
Any
try_reservemethods of container types (12 in Rust 1,62.1, including duplicated ones inalloc), and maybe correspondingtry_reserve_exactmethods.std::collections::BinaryHeap::try_reserve[_exact]std::collections::VecDeque::try_reserve[_exact]std::collections::HashMap::try_reservestd::collections::HashSet::try_reservestd::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_reservedescribes "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.