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

Vec::capacity documentation is ambiguous #103326

Closed
akonradi opened this issue Oct 20, 2022 · 1 comment · Fixed by #103482
Closed

Vec::capacity documentation is ambiguous #103326

akonradi opened this issue Oct 20, 2022 · 1 comment · Fixed by #103482
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Comments

@akonradi
Copy link

Location

Standard library documentation for Vec::capacity (https://doc.rust-lang.org/std/vec/struct.Vec.html#method.capacity)

Summary

It's not clear whether the returned capacity is the total capacity or remaining capacity of the vector. The text and example don't seem to signal either way.

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

the8472 commented Oct 20, 2022

Vec's struct-level documentation provides context: https://doc.rust-lang.org/std/vec/struct.Vec.html#capacity-and-reallocation

@inquisitivecrystal inquisitivecrystal added C-bug Category: This is a bug. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 25, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Oct 25, 2022
Clairify Vec::capacity docs

Update both the text and example to be clear that the method gives *total*, (not *spare*) capacity

Fixes rust-lang#103326
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Oct 25, 2022
Clairify Vec::capacity docs

Update both the text and example to be clear that the method gives *total*, (not *spare*) capacity

Fixes rust-lang#103326
@bors bors closed this as completed in 674cd61 Oct 25, 2022
Aaron1011 pushed a commit to Aaron1011/rust that referenced this issue Jan 6, 2023
Clairify Vec::capacity docs

Update both the text and example to be clear that the method gives *total*, (not *spare*) capacity

Fixes rust-lang#103326
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 C-bug Category: This is a bug. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants