@@ -13,7 +13,7 @@ use rustc_middle::ty::layout::LayoutError;
13
13
use rustc_middle:: ty:: { Adt , TyCtxt } ;
14
14
use rustc_span:: hygiene:: MacroKind ;
15
15
use rustc_span:: symbol:: { kw, sym, Symbol } ;
16
- use rustc_target:: abi:: { Layout , Primitive , Variants } ;
16
+ use rustc_target:: abi:: { Layout , Primitive , TagEncoding , Variants } ;
17
17
18
18
use super :: {
19
19
collect_paths_for_type, document, ensure_trailing_slash, item_ty_to_strs, notable_traits_decl,
@@ -1639,7 +1639,9 @@ fn document_type_layout(w: &mut Buffer, cx: &Context<'_>, ty_def_id: DefId) {
1639
1639
w. write_str ( "<p><strong>Size:</strong> " ) ;
1640
1640
write_size_of_layout ( w, ty_layout. layout , 0 ) ;
1641
1641
writeln ! ( w, "</p>" ) ;
1642
- if let Variants :: Multiple { variants, tag, .. } = & ty_layout. layout . variants {
1642
+ if let Variants :: Multiple { variants, tag, tag_encoding, .. } =
1643
+ & ty_layout. layout . variants
1644
+ {
1643
1645
if !variants. is_empty ( ) {
1644
1646
w. write_str (
1645
1647
"<p><strong>Size for each variant:</strong></p>\
@@ -1652,10 +1654,12 @@ fn document_type_layout(w: &mut Buffer, cx: &Context<'_>, ty_def_id: DefId) {
1652
1654
span_bug ! ( tcx. def_span( ty_def_id) , "not an adt" )
1653
1655
} ;
1654
1656
1655
- let tag_size = if let Primitive :: Int ( i, _) = tag. value {
1657
+ let tag_size = if let TagEncoding :: Niche { .. } = tag_encoding {
1658
+ 0
1659
+ } else if let Primitive :: Int ( i, _) = tag. value {
1656
1660
i. size ( ) . bytes ( )
1657
1661
} else {
1658
- span_bug ! ( tcx. def_span( ty_def_id) , "tag is not int" )
1662
+ span_bug ! ( tcx. def_span( ty_def_id) , "tag is neither niche nor int" )
1659
1663
} ;
1660
1664
1661
1665
for ( index, layout) in variants. iter_enumerated ( ) {
0 commit comments