Change tag_field to FieldIdx in Variants::Multiple

It was already available as a generic parameter anyway, and it's not like we'll ever put a tag in the 5-billionth field.
This commit is contained in:
Scott McMurray
2025-06-03 23:42:21 -07:00
parent 792fc2b033
commit ee9901e65c
14 changed files with 33 additions and 31 deletions

View File

@@ -932,7 +932,7 @@ fn variant_info_for_coroutine<'tcx>(
// However, if the discriminant is placed past the end of the variant, then we need
// to factor in the size of the discriminant manually. This really should be refactored
// better, but this "works" for now.
if layout.fields.offset(tag_field) >= variant_size {
if layout.fields.offset(tag_field.as_usize()) >= variant_size {
variant_size += match tag_encoding {
TagEncoding::Direct => tag.size(cx),
_ => Size::ZERO,