[rustc_abi] Customize Debug for Primitive and Scalar#159539
Merged
rust-bors[bot] merged 1 commit intoJul 19, 2026
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
scottmcm
force-pushed
the
nicer-rustc_abi-primitive-debug
branch
from
July 19, 2026 02:40
b3c3b51 to
a5fe990
Compare
scottmcm
marked this pull request as ready for review
July 19, 2026 05:31
Collaborator
|
r? @jieyouxu rustbot has assigned @jieyouxu. Use Why was this reviewer chosen?The reviewer was selected based on:
|
Of late I've been looking at layout a bunch, which means staring at things like
```rust
backend_repr: ScalarPair {
a: Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
b: Union {
value: Int(
I8,
false,
),
},
b_offset: Size(1 bytes),
},
```
and that's just kinda long and unfriendly.
Thus this PR that just changes `Debug` -- nothing else! -- so for example that shows as
```rust
backend_repr: ScalarPair {
a: u8 is 0..=1,
b: union u8,
b_offset: Size(1 bytes),
},
```
scottmcm
force-pushed
the
nicer-rustc_abi-primitive-debug
branch
from
July 19, 2026 06:29
a5fe990 to
d0c3ca1
Compare
jieyouxu
approved these changes
Jul 19, 2026
Comment on lines
+1499
to
+1501
| // `u8 is (..=0) | (1..)` instead of `u8 is ..` is the information | ||
| // you needed because the problem is that despite being *a* full | ||
| // range it's not *the* canonical one you expected it was. |
Comment on lines
-92
to
+77
| Initialized { | ||
| value: Int( | ||
| I16, | ||
| true, | ||
| ), | ||
| valid_range: (..=1) | (65535..), | ||
| }, | ||
| i16 is -1..=1, |
Member
There was a problem hiding this comment.
Remark: yeah, this is indeed nicer
Comment on lines
-298
to
+232
| Initialized { | ||
| value: Int( | ||
| I32, | ||
| true, | ||
| ), | ||
| valid_range: 0..=4294967295, | ||
| }, | ||
| i32 is .., |
Member
There was a problem hiding this comment.
Remark: this is also nicer because it's easier to notice in the diff whether the range is actually canonically full versus the end range happens to be ${i,u}N::MAX - 1.
This comment was marked as resolved.
This comment was marked as resolved.
Member
|
Actually just r=me after PR CI is green just in case. |
This comment was marked as resolved.
This comment was marked as resolved.
Member
Author
|
@bors r=jieyouxu |
Contributor
rust-bors Bot
pushed a commit
that referenced
this pull request
Jul 19, 2026
Rollup of 5 pull requests Successful merges: - #158546 (Move `std::io::BufRead` to `alloc::io`) - #159372 (Remove SIZE generic param from DisplayBuffer in core::net) - #159548 (miri subtree update) - #159508 (Some cleanup in `rustc_attr_parsing`) - #159539 ([rustc_abi] Customize `Debug` for `Primitive` and `Scalar`)
rust-timer
added a commit
that referenced
this pull request
Jul 19, 2026
Rollup merge of #159539 - scottmcm:nicer-rustc_abi-primitive-debug, r=jieyouxu [rustc_abi] Customize `Debug` for `Primitive` and `Scalar` Of late I've been looking at layout a bunch, which means staring at things like ```rust backend_repr: ScalarPair { a: Initialized { value: Int( I8, false, ), valid_range: 0..=1, }, b: Union { value: Int( I8, false, ), }, b_offset: Size(1 bytes), }, ``` and that's just kinda long and unfriendly. Thus this PR that just changes `Debug` -- nothing else! -- so for example that shows as ```rust backend_repr: ScalarPair { a: u8 is 0..=1, b: union u8, b_offset: Size(1 bytes), }, ``` --- EDIT: oh, net -1404 lines is a pretty good summary of why 🙃
pull Bot
pushed a commit
to xtqqczze/rust-lang-miri
that referenced
this pull request
Jul 22, 2026
Rollup of 5 pull requests Successful merges: - rust-lang/rust#158546 (Move `std::io::BufRead` to `alloc::io`) - rust-lang/rust#159372 (Remove SIZE generic param from DisplayBuffer in core::net) - rust-lang/rust#159548 (miri subtree update) - rust-lang/rust#159508 (Some cleanup in `rustc_attr_parsing`) - rust-lang/rust#159539 ([rustc_abi] Customize `Debug` for `Primitive` and `Scalar`)
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.
Of late I've been looking at layout a bunch, which means staring at things like
and that's just kinda long and unfriendly.
Thus this PR that just changes
Debug-- nothing else! -- so for example that shows asEDIT: oh, net -1404 lines is a pretty good summary of why 🙃