feat: non-panicking Vec::try_remove by BenjaminBrienen · Pull Request #146293 · rust-lang/rust (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation21 Commits1 Checks10 Files changed
Conversation
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
[ Show hidden characters]({{ revealButtonHref }})
if index < my_vector.len() { Some(my_vector.remove(index)) } else { None } is annoying to write and non-panicking functions are broadly useful.
Tracking issue: #146954
rustbot has assigned @workingjubilee.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.
Use r? to explicitly pick a reviewer
rustbot added S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
Relevant to the library team, which will review and decide on the PR/issue.
labels
BenjaminBrienen changed the title
feat: non-panicking Vec::try_remove feat: non-panicking Vec::try_remove
This comment has been minimized.
This comment has been minimized.
Looks like I inadvertently repeated #77480
I'd still like to reopen the discussion about this.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment has been minimized.
joboet left a comment • Loading
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, and could you squash the commits, please?
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.
Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.
Vec::try_remove is a non-panicking version of Vec::remove
Great, thank you!
@bors r+ rollup
📌 Commit 5673449 has been approved by joboet
It is now in the queue for this repository.
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
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request
feat: non-panicking Vec::try_remove
if index < my_vector.len() { Some(my_vector.remove(index)) } else { None } is annoying to write and non-panicking functions are broadly useful.
Tracking issue: rust-lang#146954
This was referenced
Sep 25, 2025
bors added a commit that referenced this pull request
Rollup of 8 pull requests
Successful merges:
- #116882 (rustdoc: hide
#[repr]if it isn't part of the public ABI) - #135771 ([rustdoc] Add support for associated items in "jump to def" feature)
- #141032 (avoid violating
slice::from_raw_partssafety contract inVec::extract_if) - #142401 (Add proper name mangling for pattern types)
- #146293 (feat: non-panicking
Vec::try_remove) - #146859 (BTreeMap: Don't leak allocators when initializing nodes)
- #146924 (Add doc for
NonZero*const creation) - #146933 (Make
render_example_with_highlightingreturn animpl fmt::Display)
r? @ghost
@rustbot modify labels: rollup
rust-timer added a commit that referenced this pull request
Rollup merge of #146293 - BenjaminBrienen:try_remove, r=joboet
feat: non-panicking Vec::try_remove
if index < my_vector.len() { Some(my_vector.remove(index)) } else { None } is annoying to write and non-panicking functions are broadly useful.
Tracking issue: #146954
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request
feat: non-panicking Vec::try_remove
if index < my_vector.len() { Some(my_vector.remove(index)) } else { None } is annoying to write and non-panicking functions are broadly useful.
Tracking issue: rust-lang#146954
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request
…iaskrgr
Rollup of 8 pull requests
Successful merges:
- rust-lang#116882 (rustdoc: hide
#[repr]if it isn't part of the public ABI) - rust-lang#135771 ([rustdoc] Add support for associated items in "jump to def" feature)
- rust-lang#141032 (avoid violating
slice::from_raw_partssafety contract inVec::extract_if) - rust-lang#142401 (Add proper name mangling for pattern types)
- rust-lang#146293 (feat: non-panicking
Vec::try_remove) - rust-lang#146859 (BTreeMap: Don't leak allocators when initializing nodes)
- rust-lang#146924 (Add doc for
NonZero*const creation) - rust-lang#146933 (Make
render_example_with_highlightingreturn animpl fmt::Display)
r? @ghost
@rustbot modify labels: rollup
Labels
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Relevant to the library team, which will review and decide on the PR/issue.