-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Change field bit_width: usize to bits: u32 in type info
#151235
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
Merged
Merged
+34
−34
Conversation
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
Collaborator
|
|
Contributor
|
@bors r+ rollup |
Contributor
Member
|
👍 This fits well with rust-lang/compiler-team#693 to me too, where things like |
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Jan 18, 2026
Change field `bit_width: usize` to `bits: u32` in type info Follow-up rust-lang#151123 (comment). Quotes: @Skgland: > > I'm not sure whether we should use `usize` or `u64` here to represent the bit width. > > My expectation would be `u32` matching the associated `{u,i}N::BITS`[^1][^2][^3] constant that already exists on the integer types. > > [^1]: https://doc.rust-lang.org/std/primitive.i8.html#associatedconstant.BITS > [^2]: https://doc.rust-lang.org/std/primitive.i128.html#associatedconstant.BITS > [^3]: https://doc.rust-lang.org/std/primitive.usize.html#associatedconstant.BITS @SpriteOvO: > I found some [previous discussions](rust-lang#76492 (comment)) regarding the type of `::BITS` constant. And during the stabilization of `::BITS`, the choice of `u32` affected some ecosystem crates (rust-lang#81654), but soon after, these crates all accepted the `u32` type. > > So I think it makes sense to keep the type consistent with `::BITS` here. Then I'd also like to change the name from `bit_width` to `bits`, also for consistency. r? @oli-obk
rust-bors bot
pushed a commit
that referenced
this pull request
Jan 18, 2026
Rollup of 9 pull requests Successful merges: - #148769 (Stabilize `alloc_layout_extra`) - #149440 (Remove suggestion from importing unstable items on stable channel) - #150200 (Add title field to `ice.md` issue template) - #150955 (Underscore-prefixed bindings are explicitly allowed to be unused) - #151200 (time: Add saturating arithmetic for `SystemTime`) - #151235 (Change field `bit_width: usize` to `bits: u32` in type info) - #151242 (Port #[needs_allocator] to attribute parser) - #151274 (Include a link to `count_ones` in the docs for `uN::count_zeros` [docs only]) - #151279 (remove trailing periods in built-in attribute gate messages) r? @ghost
rust-bors bot
pushed a commit
that referenced
this pull request
Jan 18, 2026
Rollup of 8 pull requests Successful merges: - #148769 (Stabilize `alloc_layout_extra`) - #150200 (Add title field to `ice.md` issue template) - #150955 (Underscore-prefixed bindings are explicitly allowed to be unused) - #151200 (time: Add saturating arithmetic for `SystemTime`) - #151235 (Change field `bit_width: usize` to `bits: u32` in type info) - #151242 (Port #[needs_allocator] to attribute parser) - #151274 (Include a link to `count_ones` in the docs for `uN::count_zeros` [docs only]) - #151279 (remove trailing periods in built-in attribute gate messages) r? @ghost
rust-timer
added a commit
that referenced
this pull request
Jan 18, 2026
Rollup merge of #151235 - type-info-rename-bits, r=oli-obk Change field `bit_width: usize` to `bits: u32` in type info Follow-up #151123 (comment). Quotes: @Skgland: > > I'm not sure whether we should use `usize` or `u64` here to represent the bit width. > > My expectation would be `u32` matching the associated `{u,i}N::BITS`[^1][^2][^3] constant that already exists on the integer types. > > [^1]: https://doc.rust-lang.org/std/primitive.i8.html#associatedconstant.BITS > [^2]: https://doc.rust-lang.org/std/primitive.i128.html#associatedconstant.BITS > [^3]: https://doc.rust-lang.org/std/primitive.usize.html#associatedconstant.BITS @SpriteOvO: > I found some [previous discussions](#76492 (comment)) regarding the type of `::BITS` constant. And during the stabilization of `::BITS`, the choice of `u32` affected some ecosystem crates (#81654), but soon after, these crates all accepted the `u32` type. > > So I think it makes sense to keep the type consistent with `::BITS` here. Then I'd also like to change the name from `bit_width` to `bits`, also for consistency. r? @oli-obk
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
F-type_info
#![feature(type_info)]
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
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.
Follow-up #151123 (comment). Quotes:
@Skgland:
@SpriteOvO:
r? @oli-obk
Footnotes
https://doc.rust-lang.org/std/primitive.i8.html#associatedconstant.BITS ↩
https://doc.rust-lang.org/std/primitive.i128.html#associatedconstant.BITS ↩
https://doc.rust-lang.org/std/primitive.usize.html#associatedconstant.BITS ↩