-
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 leading 0x to offset in Debug fmt of Pointer #71459
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @RalfJung (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
5a3245f
to
c16b6e0
Compare
🤷 I don't have a strong opinion. It'll make the relocation size problem in the hex dump worse though, which I think is the main reason I tried to keep it as short as possible |
I wonder why hex dumps do not show up in the diff here? At least for pointers outside of hex dumps, I think this is a clear improvement. Even within hex dumps, I'd rather shorten |
For example,
How can that be? |
Likely because the refactoring for the |
Ah, indeed it does: rust/src/librustc_mir/util/pretty.rs Line 725 in 66f7a5d
So should we take advantage of that and leave the dumps without 0x ? Seems oddly inconsistent though. (And btw this needs a FIXME to also print the tag.)
What about landing this PR to change just |
Yea, makes sense, let's merge this PR |
@bors r+ |
📌 Commit c16b6e0 has been approved by |
…RalfJung Add leading 0x to offset in Debug fmt of Pointer Currently the `Debug` format for `Pointer` prints its offset in hexadecimal, for example, `alloc38657819+e2` or `alloc35122748+64`. This PR adds a leading `0x` to the offset, in order to make it apparent that it is indeed a hexadecimal number. This came up during discussion of rust-lang/miri#1354. r? @RalfJung
Rollup of 6 pull requests Successful merges: - rust-lang#70845 (Make the `structural_match` error diagnostic for const generics clearer) - rust-lang#71063 (Document unsafety in core::{option, hash}) - rust-lang#71068 (Stabilize UNICODE_VERSION (feature unicode_version)) - rust-lang#71426 (fix error code in E0751.md) - rust-lang#71459 (Add leading 0x to offset in Debug fmt of Pointer) - rust-lang#71492 (Document unsafety in core::{panicking, alloc::layout, hint, iter::adapters::zip}) Failed merges: r? @ghost
Turns out MIR allocation dumping was actually using decimal, while normal |
@RalfJung I'm surprised you didn't notice #71459 (comment) had no I never expected hex offsets, since I had only seen decimal ones thus far. |
Pointer printing was using hex offsets since at least since d01ef7d. |
Currently the
Debug
format forPointer
prints its offset in hexadecimal, for example,alloc38657819+e2
oralloc35122748+64
. This PR adds a leading0x
to the offset, in order to make it apparent that it is indeed a hexadecimal number. This came up during discussion of rust-lang/miri#1354. r? @RalfJung