-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Add drain_filter method to HashMap and HashSet #76458
Conversation
r? @cramertj (rust_highfive has picked a reviewer for you, use r? to override) |
You might want to double-check if the representation change affected the debuginfo providers and tests:
Otherwise LGTM. |
60750d6
to
c589c41
Compare
Thanks for the tip! I updated this branch to fix to debuginfo providers for both gdb and lldb. |
I think |
c589c41
to
4bbd823
Compare
This is now updated, though I don't have a Windows machine to test it on. |
@bors r+ |
📌 Commit 4bbd823198c127e71a70a6992abbd915f298173a has been approved by |
Rollup of 10 pull requests Successful merges: - rust-lang#76162 (Make duration_since documentation more clear) - rust-lang#76355 (remove public visibility previously needed for rustfmt) - rust-lang#76374 (Improve ayu doc source line number contrast) - rust-lang#76379 (rustbuild: Remove `Mode::Codegen`) - rust-lang#76389 (Fix HashMap visualizers in Visual Studio (Code)) - rust-lang#76396 (Fix typo in tracking issue template) - rust-lang#76401 (Add help note to unconstrained const parameter) - rust-lang#76402 (Update linker-plugin-lto.md to contain up to rust 1.46) - rust-lang#76403 (Fix documentation for TyCtxt::all_impls) - rust-lang#76498 (Update cargo) Failed merges: - rust-lang#76458 (Add drain_filter method to HashMap and HashSet) r? `@ghost`
☔ The latest upstream changes (presumably #76502) made this pull request unmergeable. Please resolve the merge conflicts. Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:
|
4bbd823
to
fb1fab5
Compare
@rustbot modify labels: +S-waiting-on-review -S-waiting-on-author Rebased to resolve a merge conflict in |
@bors r+ |
📌 Commit fb1fab5 has been approved by |
Rollup of 7 pull requests Successful merges: - rust-lang#74787 (Move `rustllvm` into `compiler/rustc_llvm`) - rust-lang#76458 (Add drain_filter method to HashMap and HashSet) - rust-lang#76472 (rustbuild: don't set PYTHON_EXECUTABLE and WITH_POLLY cmake vars since they are no longer supported by llvm) - rust-lang#76497 (Use intra-doc links in `core::ptr`) - rust-lang#76500 (Add -Zgraphviz_dark_mode and monospace font fix) - rust-lang#76543 (Document btree's unwrap_unchecked) - rust-lang#76556 (Revert rust-lang#76285) Failed merges: r? `@ghost`
The corresponding PRs in rustc: rust-lang/rust#76458 rust-lang/rust#70052
The corresponding PRs in rustc: rust-lang/rust#76458 rust-lang/rust#70052
6258: Update HashMap/HashSet pretty-printers to Rust 1.47 r=Undin a=ortem Fixes #6198 The corresponding PRs in rustc: rust-lang/rust#76458 rust-lang/rust#70052 Besides these changes from the upstreamed pretty-printers, I've added `GetTypedefedType` (LLDB) and `strip_typedefs` (GDB) calls to resolve key and value types completely. Without these calls, LLDB doesn't show the actual type and so CLion fails to show the content of key/value pairs. For example, with `GetTypedefedType`: ``` (lldb) frame variable hm[0] ((i32, alloc::string::String)) hm[0] = { ... } ``` and without: ``` (lldb) frame variable hm[0] (T) hm[0] = { ... } ``` **Before merge, test on**: - [x] Linux + Bundled GDB + Rust 1.46 - [x] Linux + Bundled LLDB + Rust 1.46 - [x] Linux + Bundled GDB + Rust 1.47 - [x] Linux + Bundled LLDB + Rust 1.47 - [x] macOS + Bundled LLDB + Rust 1.46 - [x] macOS + Bundled LLDB + Rust 1.47 - [ ] Windows + MinGW/Cygwin GDB + Rust 1.47 - [ ] Windows + MinGW/Cygwin GDB + Rust 1.46 **Does not work on Windows + MSVC LLDB** due to the lack of native Rust support patches **After merge** - [ ] Upstream to rustc Co-authored-by: ortem <[email protected]>
The corresponding PRs in rustc: rust-lang/rust#76458 rust-lang/rust#70052 (cherry picked from commit d56d9e3)
Add
HashMap::drain_filter
andHashSet::drain_filter
, implementing part of rust-lang/rfcs#2140. These new methods are unstable. The tracking issue is #59618.The added iterators behave the same as
BTreeMap::drain_filter
andBTreeSet::drain_filter
, except their iteration order is arbitrary. The unit tests are adapted fromalloc::collections::btree
.This branch rewrites
HashSet
to be a wrapper aroundhashbrown::HashSet
rather thanstd::collections::HashMap
.(Both are themselves wrappers around
hashbrown::HashMap
, so the in-memory representation is the same either way.) This letsstd
re-use more iterator code fromhashbrown
. Without this change, we would need to duplicate much more code to implementHashSet::drain_filter
.This branch also updates the
hashbrown
crate to version 0.9.0. Aside from changes related to theDrainFilter
iterators, this version only changes features that are not used in libstd or rustc. And it updatesindexmap
to version 1.6.0, whose only change is compatibility withhashbrown
0.9.0.