Files
rust/compiler/rustc_const_eval
Matthias Krüger ac7ba99209 Rollup merge of #156403 - SpriteOvO:type-info-refactor-variant, r=oli-obk
Add `TypeId` methods `variants` `fields` `field` for `type_info`

Tracking issue rust-lang/rust#146922

- Adds `fn TypeId::variants` returns the number of variants, for struct and union and primitive types, it's always 1.
- Adds `fn TypeId::fields` returns the number of fields.
- Adds `fn TypeId::field` returns a field representing type `FieldId`.
- Adds a new type `FieldId`, which is a wrapper of `FieldRepresentingType`'s `TypeId`.

For methods `{fields,field}`, if indexing out of bounds, a compile-time error will be raised.

Regarding the removal of `Type` items, this will be done in a later PR in one go.

r? @oli-obk
2026-05-28 07:53:35 +02:00
..