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

Change Vec examples to not assert exact capacity except where it is guaranteed #111592

Merged
merged 1 commit into from
May 16, 2023

Conversation

Nemo157
Copy link
Member

@Nemo157 Nemo157 commented May 15, 2023

It was brought up on discord that the Vec::into_boxed_slice example contradicted the Vec::with_capacity docs in that the returned Vec might have more capacity than requested.

So, to reduce confusion change all the assert_eq!(vec.capacity(), _) to assert!(vec.capacity() >= _), except in 4 examples that have guaranteed capacities: Vec::from_raw_parts, Vec::from_raw_parts_in, Vec::<()>::with_capacity,Vec::<(), _>::with_capacity_in.

@rustbot
Copy link
Collaborator

rustbot commented May 15, 2023

r? @joshtriplett

(rustbot has picked a reviewer for you, use r? to override)

@rustbot
Copy link
Collaborator

rustbot commented May 15, 2023

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@joshtriplett
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented May 16, 2023

📌 Commit a9cb482 has been approved by joshtriplett

It is now in the queue for this repository.

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label May 16, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request May 16, 2023
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#107680 (Hide repr attribute from doc of types without guaranteed repr)
 - rust-lang#111488 (Use error term in projection if missing associated item in new solver)
 - rust-lang#111533 (Handle error body in generator layout)
 - rust-lang#111573 (Erase `ReError` properly)
 - rust-lang#111592 (Change Vec examples to not assert exact capacity except where it is guaranteed)
 - rust-lang#111610 (fix(diagnostic): wrap parens for ref impl trait param)
 - rust-lang#111642 ([rustdoc] Only keep impl blocks from bodies)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 20f6aa1 into rust-lang:master May 16, 2023
@rustbot rustbot added this to the 1.71.0 milestone May 16, 2023
@Nemo157 Nemo157 deleted the fix-vec-capacity-examples branch May 16, 2023 22:36
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants