Change Vec examples to not assert exact capacity except where it is guaranteed#111592
Merged
Conversation
Collaborator
|
(rustbot has picked a reviewer for you, use r? to override) |
Collaborator
|
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
Member
|
@bors r+ rollup |
Collaborator
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It was brought up on discord that the
Vec::into_boxed_sliceexample contradicted theVec::with_capacitydocs in that the returnedVecmight have more capacity than requested.So, to reduce confusion change all the
assert_eq!(vec.capacity(), _)toassert!(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.