Files
rust/tests/ui/reflection/dump.bit32.run.stdout
T
Jacob Pratt 80db7158af Rollup merge of #151235 - type-info-rename-bits, r=oli-obk
Change field `bit_width: usize` to `bits: u32` in type info

Follow-up https://github.com/rust-lang/rust/pull/151123#discussion_r2698418929. 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](https://github.com/rust-lang/rust/pull/76492#issuecomment-700516940) 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
2026-01-18 03:16:46 -05:00

222 lines
3.2 KiB
Plaintext

Type {
kind: Tuple(
Tuple {
fields: [
Field {
ty: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb),
offset: 0,
},
Field {
ty: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb),
offset: 1,
},
Field {
ty: TypeId(0x41223169ff28813ba79b7268a2a968d9),
offset: 2,
},
],
},
),
size: Some(
2,
),
}
Type {
kind: Array(
Array {
element_ty: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb),
len: 2,
},
),
size: Some(
2,
),
}
Type {
kind: Int(
Int {
bits: 8,
signed: true,
},
),
size: Some(
1,
),
}
Type {
kind: Int(
Int {
bits: 32,
signed: true,
},
),
size: Some(
4,
),
}
Type {
kind: Int(
Int {
bits: 64,
signed: true,
},
),
size: Some(
8,
),
}
Type {
kind: Int(
Int {
bits: 128,
signed: true,
},
),
size: Some(
16,
),
}
Type {
kind: Int(
Int {
bits: 32,
signed: true,
},
),
size: Some(
4,
),
}
Type {
kind: Int(
Int {
bits: 8,
signed: false,
},
),
size: Some(
1,
),
}
Type {
kind: Int(
Int {
bits: 32,
signed: false,
},
),
size: Some(
4,
),
}
Type {
kind: Int(
Int {
bits: 64,
signed: false,
},
),
size: Some(
8,
),
}
Type {
kind: Int(
Int {
bits: 128,
signed: false,
},
),
size: Some(
16,
),
}
Type {
kind: Int(
Int {
bits: 32,
signed: false,
},
),
size: Some(
4,
),
}
Type {
kind: Other,
size: Some(
4,
),
}
Type {
kind: Other,
size: Some(
12,
),
}
Type {
kind: Reference(
Reference {
pointee: TypeId(0xda1b6da9bd297bb2900de9303aadea79),
mutable: false,
},
),
size: Some(
8,
),
}
Type {
kind: Reference(
Reference {
pointee: TypeId(0x474ccf3b5db264ef53916706f7d7bb2c),
mutable: false,
},
),
size: Some(
8,
),
}
Type {
kind: Reference(
Reference {
pointee: TypeId(0x641e3def269c37acc6dcb92bf8c5f196),
mutable: false,
},
),
size: Some(
8,
),
}
Type {
kind: Str(
Str,
),
size: None,
}
Type {
kind: Other,
size: None,
}
Type {
kind: Reference(
Reference {
pointee: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb),
mutable: false,
},
),
size: Some(
4,
),
}
Type {
kind: Reference(
Reference {
pointee: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb),
mutable: true,
},
),
size: Some(
4,
),
}