Skip to content
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

Removal of exact capacity guarantee for Vec::with_capacity() is a breaking change #99385

Closed
GoldsteinE opened this issue Jul 17, 2022 · 1 comment · Fixed by #135933
Closed
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@GoldsteinE
Copy link
Contributor

Link #95614
Cc @jmaargh

Location

https://doc.rust-lang.org/nightly/std/vec/struct.Vec.html#method.with_capacity

Summary

Latest stable guarantees that Vec::with_capacity() always allocates exact capacity (and this is indeed the case, since RawVec discards any extra allocated capacity). #96173 removes this guarantee. I believe this to be a breaking change requiring some further investigation.

@GoldsteinE GoldsteinE added the A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools label Jul 17, 2022
@the8472
Copy link
Member

the8472 commented Jul 17, 2022

@m-ou-se m-ou-se added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. I-libs-api-nominated Nominated for discussion during a libs-api team meeting. labels Oct 11, 2022
@m-ou-se m-ou-se removed the I-libs-api-nominated Nominated for discussion during a libs-api team meeting. label Oct 18, 2022
@bors bors closed this as completed in dc2b86f Feb 25, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Feb 25, 2025
Rollup merge of rust-lang#135933 - hkBst:patch-19, r=workingjubilee

Explain how Vec::with_capacity is faithful

This is a revival of rust-lang#99790 building on the prose of `@workingjubilee` and edits of `@jmaargh.` Closes rust-lang#99385.
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Feb 26, 2025
Explain how Vec::with_capacity is faithful

This is a revival of rust-lang/rust#99790 building on the prose of `@workingjubilee` and edits of `@jmaargh.` Closes rust-lang/rust#99385.
github-actions bot pushed a commit to tautschnig/verify-rust-std that referenced this issue Mar 11, 2025
Explain how Vec::with_capacity is faithful

This is a revival of rust-lang#99790 building on the prose of `@workingjubilee` and edits of `@jmaargh.` Closes rust-lang#99385.
github-actions bot pushed a commit to tautschnig/verify-rust-std that referenced this issue Mar 11, 2025
Explain how Vec::with_capacity is faithful

This is a revival of rust-lang#99790 building on the prose of `@workingjubilee` and edits of `@jmaargh.` Closes rust-lang#99385.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
3 participants