Skip to content

Commit b644f06

Browse files
committed
Resolve EnumTagInfo FIXME
1 parent f353cbf commit b644f06

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,7 +1507,7 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> {
15071507
cx,
15081508
self.layout,
15091509
variant_info,
1510-
NoTag,
1510+
None,
15111511
self_metadata,
15121512
self.span,
15131513
);
@@ -1539,13 +1539,13 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> {
15391539
..
15401540
} => {
15411541
let tag_info = if fallback {
1542-
RegularTag {
1542+
Some(DirectTag {
15431543
tag_field: Field::from(tag_field),
15441544
tag_type_metadata: self.tag_type_metadata.unwrap(),
1545-
}
1545+
})
15461546
} else {
15471547
// This doesn't matter in this case.
1548-
NoTag
1548+
None
15491549
};
15501550
variants
15511551
.iter_enumerated()
@@ -1606,7 +1606,7 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> {
16061606
cx,
16071607
variant,
16081608
variant_info_for(dataful_variant),
1609-
OptimizedTag,
1609+
Some(NicheTag),
16101610
self.containing_scope,
16111611
self.span,
16121612
);
@@ -1681,7 +1681,7 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> {
16811681
cx,
16821682
variant,
16831683
variant_info,
1684-
OptimizedTag,
1684+
Some(NicheTag),
16851685
self_metadata,
16861686
self.span,
16871687
);
@@ -1771,14 +1771,10 @@ impl VariantMemberDescriptionFactory<'ll, 'tcx> {
17711771
}
17721772
}
17731773

1774-
// FIXME: terminology here should be aligned with `abi::TagEncoding`.
1775-
// `OptimizedTag` is `TagEncoding::Niche`, `RegularTag` is `TagEncoding::Direct`.
1776-
// `NoTag` should be removed; users should use `Option<EnumTagInfo>` instead.
17771774
#[derive(Copy, Clone)]
17781775
enum EnumTagInfo<'ll> {
1779-
RegularTag { tag_field: Field, tag_type_metadata: &'ll DIType },
1780-
OptimizedTag,
1781-
NoTag,
1776+
DirectTag { tag_field: Field, tag_type_metadata: &'ll DIType },
1777+
NicheTag,
17821778
}
17831779

17841780
#[derive(Copy, Clone)]
@@ -1859,7 +1855,7 @@ fn describe_enum_variant(
18591855
cx: &CodegenCx<'ll, 'tcx>,
18601856
layout: layout::TyAndLayout<'tcx>,
18611857
variant: VariantInfo<'_, 'tcx>,
1862-
discriminant_info: EnumTagInfo<'ll>,
1858+
discriminant_info: Option<EnumTagInfo<'ll>>,
18631859
containing_scope: &'ll DIScope,
18641860
span: Span,
18651861
) -> (&'ll DICompositeType, MemberDescriptionFactory<'ll, 'tcx>) {
@@ -1882,7 +1878,7 @@ fn describe_enum_variant(
18821878
let (offsets, args) = if use_enum_fallback(cx) {
18831879
// If this is not a univariant enum, there is also the discriminant field.
18841880
let (discr_offset, discr_arg) = match discriminant_info {
1885-
RegularTag { tag_field, .. } => {
1881+
Some(DirectTag { tag_field, .. }) => {
18861882
// We have the layout of an enum variant, we need the layout of the outer enum
18871883
let enum_layout = cx.layout_of(layout.ty);
18881884
let offset = enum_layout.fields.offset(tag_field.as_usize());
@@ -1919,7 +1915,7 @@ fn describe_enum_variant(
19191915
offsets,
19201916
args,
19211917
tag_type_metadata: match discriminant_info {
1922-
RegularTag { tag_type_metadata, .. } => Some(tag_type_metadata),
1918+
Some(DirectTag { tag_type_metadata, .. }) => Some(tag_type_metadata),
19231919
_ => None,
19241920
},
19251921
span,

0 commit comments

Comments
 (0)