More informative Debug for vec::ExtractIf#154581
Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom Apr 4, 2026
Merged
More informative Debug for vec::ExtractIf#154581rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Debug for vec::ExtractIf#154581rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Conversation
Collaborator
|
rustbot has assigned @Mark-Simulacrum. Use Why was this reviewer chosen?The reviewer was selected based on:
|
Member
|
@bors r+ |
Contributor
rust-bors bot
pushed a commit
that referenced
this pull request
Apr 4, 2026
…uwer Rollup of 8 pull requests Successful merges: - #149868 (rustc: Stop passing `--allow-undefined` on wasm targets) - #153555 (Clarified docs in std::sync::RwLock + added test to ensure that max reader count is respected) - #152851 (Fix SGX delayed host lookup via ToSocketAddr) - #154051 (use libm for acosh and asinh) - #154581 (More informative `Debug for vec::ExtractIf`) - #154461 (Edit the docs new_in() and with_capacity_in()) - #154526 (Panic/return false on overflow in no_threads read/try_read impl) - #154798 (rustdoc-search: match path components on words)
rust-timer
added a commit
that referenced
this pull request
Apr 4, 2026
Rollup merge of #154581 - GrigorenkoPV:extract-if-debug, r=Mark-Simulacrum More informative `Debug for vec::ExtractIf` While working on #154318, I've realized that `vec::ExtractIf` actually maintains a valid prefix and a valid suffix in the underlying vector at all times with all the temporarily-invalid elements being only in the middle. So why not make the `Debug` output more informative? I guess we could even expose something like `get_retained_mut(&mut self) -> &mut [T]` and `get_remainder_mut(&mut self) -> &mut [T]`, but that would add new backwards compatibility burden, unlike the `Debug` implementation, which (IIRC) can be changed at any time.
github-actions bot
pushed a commit
to rust-lang/miri
that referenced
this pull request
Apr 5, 2026
…uwer Rollup of 8 pull requests Successful merges: - rust-lang/rust#149868 (rustc: Stop passing `--allow-undefined` on wasm targets) - rust-lang/rust#153555 (Clarified docs in std::sync::RwLock + added test to ensure that max reader count is respected) - rust-lang/rust#152851 (Fix SGX delayed host lookup via ToSocketAddr) - rust-lang/rust#154051 (use libm for acosh and asinh) - rust-lang/rust#154581 (More informative `Debug for vec::ExtractIf`) - rust-lang/rust#154461 (Edit the docs new_in() and with_capacity_in()) - rust-lang/rust#154526 (Panic/return false on overflow in no_threads read/try_read impl) - rust-lang/rust#154798 (rustdoc-search: match path components on words)
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.
While working on #154318, I've realized that
vec::ExtractIfactually maintains a valid prefix and a valid suffix in the underlying vector at all times with all the temporarily-invalid elements being only in the middle.So why not make the
Debugoutput more informative? I guess we could even expose something likeget_retained_mut(&mut self) -> &mut [T]andget_remainder_mut(&mut self) -> &mut [T], but that would add new backwards compatibility burden, unlike theDebugimplementation, which (IIRC) can be changed at any time.