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 example code for Vec::splice to change the length #92071

Merged
merged 1 commit into from
Dec 19, 2021
Merged

Update example code for Vec::splice to change the length #92071

merged 1 commit into from
Dec 19, 2021

Conversation

ajtribick
Copy link
Contributor

The current example for Vec::splice illustrates the replacement of a section of length 2 with a new section of length 2. This isn't a particularly interesting case for splice, and makes it look a bit like a shorthand for the kind of manipulations that could be done with a mutable slice.

In order to provide a stronger example, this updates the example to use different lengths for the source and destination regions, and uses a slice from the middle of the vector to illustrate that this does not necessarily have to be at the beginning or the end.

Resolves #92067

@rust-highfive
Copy link
Collaborator

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

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 18, 2021
@jyn514 jyn514 added A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Dec 18, 2021
@the8472
Copy link
Member

the8472 commented Dec 18, 2021

LGTM

@bors r+ rollup=always

@bors
Copy link
Contributor

bors commented Dec 18, 2021

📌 Commit 574bc67 has been approved by the8472

@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 Dec 18, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 19, 2021
…askrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#91141 (Revert "Temporarily rename int_roundings functions to avoid conflicts")
 - rust-lang#91984 (Remove `in_band_lifetimes` from `rustc_middle`)
 - rust-lang#92028 (Sync portable-simd to fix libcore build for AVX-512 enabled targets)
 - rust-lang#92042 (Enable `#[thread_local]` for all windows-msvc targets)
 - rust-lang#92071 (Update example code for Vec::splice to change the length)
 - rust-lang#92077 (rustdoc: Remove unused `collapsed` field)
 - rust-lang#92081 (rustdoc: Remove unnecessary `need_backline` function)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 690d6b0 into rust-lang:master Dec 19, 2021
@rustbot rustbot added this to the 1.59.0 milestone Dec 19, 2021
@ajtribick ajtribick deleted the patch-1 branch December 19, 2021 16:43
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 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.

Improve the example for Vec::splice
7 participants