Files
rust/library/core/src
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
..
2026-04-14 18:09:15 -04:00
fix
2025-11-27 17:55:34 +07:00
2026-01-26 17:08:00 +00:00
2026-04-14 18:09:15 -04:00
2025-09-01 21:38:26 -04:00
2026-04-14 18:09:15 -04:00
2026-05-17 15:06:12 +07:00
2026-05-03 12:07:41 -04:00
2025-10-20 12:20:15 -06:00
2026-04-04 19:20:32 +02:00
2026-05-15 10:15:58 +02:00
2026-03-25 11:40:27 +07:00
2026-05-22 16:21:32 +02:00
2025-09-07 21:16:35 -07:00
2025-06-15 22:08:41 +02:00
2026-05-07 21:55:44 +03:00
2025-11-12 14:33:41 +01:00
2026-04-23 19:55:51 -07:00
2026-04-14 18:09:15 -04:00
2026-05-14 06:08:58 +00:00