A more readable debug map for IndexMaps - #159792
Conversation
|
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
This comment has been minimized.
This comment has been minimized.
0875449 to
c87892f
Compare
| } | ||
| entries.finish() | ||
| } | ||
| } |
There was a problem hiding this comment.
Should we just make this the impl for IndexVec and IndexSlice?
There was a problem hiding this comment.
Sorry, life happened and it took me a while to come back to this.
Yes, we could potentially. I figured that I frequently need to search the value under one particular index in a slice and it has not been possible.
The printout would be a bit verbose, however. Let's see how the dev ergonomics would be.
There was a problem hiding this comment.
Alright, since we do not have min_specialization in this crate yet, I will print the keys even when the index type is u32. The debug print seems to be more readable now and I like how layout printout looks like given that indices are clearly labelled.
There was a problem hiding this comment.
Ah, probably this is still not a good idea.
It turns out, out of convenience, MIR pretty-print uses debug print of IndexVec and IndexSlice. My smaller local tests did not catch this. With this MIR dump got noisier than I felt comfortable.
I would call this impl switch a deferred upgrade then. We probably would fix the MIR printing in another PR, I can imagine.
c87892f to
e18de68
Compare
|
This PR was rebased onto a different main 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. |
This comment has been minimized.
This comment has been minimized.
This small utility provides a familiar key-value view of an `IndexMap` in the debugging output. Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net> Signed-off-by: Xiangfei Ding <dingxiangfei2009@protonmail.ch>
e18de68 to
6072e64
Compare
|
Due to MIR pretty-printing using @bors r=cjgillot |
…=cjgillot A more readable debug map for IndexMaps Let's ship rust-lang#135527 more. To help future debugging, let us print the maps with a more readable format. r? @cjgillot
…=cjgillot A more readable debug map for IndexMaps Let's ship rust-lang#135527 more. To help future debugging, let us print the maps with a more readable format. r? @cjgillot
Rollup of 25 pull requests Successful merges: - #159074 ([PAC] FnAbi, llvm.ptrauth.resign and Session API change (2/8)) - #159792 (A more readable debug map for IndexMaps) - #161895 (std::sys::pal::sgx: fix mismatched alloc/free alignment) - #161900 (bootstrap: Include feature-gated items in bootstrap tool docs) - #161940 (Promote `wasm32-wasip3` to a tier 2 target) - #162072 (Add new Tier-3 target: `powerpc64-sony-ps3`) - #162179 (type system const items via direct rhs) - #162277 (Introduce `rustc_middle::middel::resolve`) - #162285 (box: fixup map/try_map deallocate calls) - #162286 (string: don't unwind prematurely) - #162289 (alloc: a bunch of safety comments) - #162292 (Update `askama` version to `0.16.1`) - #160509 (Remove `RegionExt`; move methods to `Region` in `rustc_type_ir`) - #160906 (Suggest usize instead of placeholder type for array length constants) - #160936 (traits: Represent live alias arguments as bitsets) - #161400 (Improve diagnostics for references to closures) - #161656 (Suggest mutable references for FnMut closure arguments) - #161711 (Add more splat fn type tests) - #161786 (Make `tcx.def_id_partial_cmp` public) - #161953 (sanitizers: Implicitly disable mutually exclusive sanitizers) - #162155 (add suggestion for `rustc_allowed_through_unstable_modules` attribute) - #162212 (Implement `Rng` for `Box`) - #162246 (Fix incorrect meta span) - #162266 (std: fix typo) - #162291 (Add regression test from 1.98.1)
…=cjgillot A more readable debug map for IndexMaps Let's ship rust-lang#135527 more. To help future debugging, let us print the maps with a more readable format. r? @cjgillot
Let's ship #135527 more.
To help future debugging, let us print the maps with a more readable format.
r? @cjgillot