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

Update documentation for Vec::into_boxed_slice to be more clear about excess capacity #120110

Merged
merged 1 commit into from
Jan 19, 2024

Conversation

invpt
Copy link
Contributor

@invpt invpt commented Jan 18, 2024

Currently, the documentation for Vec::into_boxed_slice says that "if the vector has excess capacity, its items will be moved into a newly-allocated buffer with exactly the right capacity." This is misleading, as copies do not necessarily occur, depending on if the allocator supports in-place shrinking. I copied some of the wording from shrink_to_fit, though it could potentially still be worded better than this.

@rustbot
Copy link
Collaborator

rustbot commented Jan 18, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (or someone else) soon.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jan 18, 2024
Copy link
Member

@the8472 the8472 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok looks good now. Can you squash your commits? Then I'll r+ it.

@the8472 the8472 assigned the8472 and unassigned Mark-Simulacrum Jan 18, 2024
@the8472
Copy link
Member

the8472 commented Jan 18, 2024

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jan 18, 2024

📌 Commit 35a9fc3 has been approved by the8472

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 18, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 19, 2024
…iaskrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#118665 (Consolidate all associated items on the NonZero integer types into a single impl block per type)
 - rust-lang#118798 (Use AtomicU8 instead of AtomicUsize in backtrace.rs)
 - rust-lang#119062 (Deny braced macro invocations in let-else)
 - rust-lang#119138 (Docs: Use non-SeqCst in module example of atomics)
 - rust-lang#119907 (Update `fn()` trait implementation docs)
 - rust-lang#120083 (Warn when not having a profiler runtime means that coverage tests won't be run/blessed)
 - rust-lang#120107 (dead_code treats #[repr(transparent)] the same as #[repr(C)])
 - rust-lang#120110 (Update documentation for Vec::into_boxed_slice to be more clear about excess capacity)
 - rust-lang#120113 (Remove myself from review rotation)
 - rust-lang#120118 (Fix typo in documentation in base.rs)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 19, 2024
…iaskrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#118665 (Consolidate all associated items on the NonZero integer types into a single impl block per type)
 - rust-lang#118798 (Use AtomicU8 instead of AtomicUsize in backtrace.rs)
 - rust-lang#119062 (Deny braced macro invocations in let-else)
 - rust-lang#119138 (Docs: Use non-SeqCst in module example of atomics)
 - rust-lang#119907 (Update `fn()` trait implementation docs)
 - rust-lang#120083 (Warn when not having a profiler runtime means that coverage tests won't be run/blessed)
 - rust-lang#120107 (dead_code treats #[repr(transparent)] the same as #[repr(C)])
 - rust-lang#120110 (Update documentation for Vec::into_boxed_slice to be more clear about excess capacity)
 - rust-lang#120113 (Remove myself from review rotation)
 - rust-lang#120118 (Fix typo in documentation in base.rs)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7219bd2 into rust-lang:master Jan 19, 2024
11 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Jan 19, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 19, 2024
Rollup merge of rust-lang#120110 - invpt:patch-1, r=the8472

Update documentation for Vec::into_boxed_slice to be more clear about excess capacity

Currently, the documentation for Vec::into_boxed_slice says that "if the vector has excess capacity, its items will be moved into a newly-allocated buffer with exactly the right capacity." This is misleading, as copies do not necessarily occur, depending on if the allocator supports in-place shrinking. I copied some of the wording from shrink_to_fit, though it could potentially still be worded better than this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants