@@ -13,7 +13,7 @@ use rustc_middle::ty::layout::LayoutError;
1313use rustc_middle:: ty:: { Adt , TyCtxt } ;
1414use rustc_span:: hygiene:: MacroKind ;
1515use rustc_span:: symbol:: { kw, sym, Symbol } ;
16- use rustc_target:: abi:: { Layout , Primitive , Variants } ;
16+ use rustc_target:: abi:: { Layout , Primitive , TagEncoding , Variants } ;
1717
1818use super :: {
1919 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) {
16391639 w. write_str ( "<p><strong>Size:</strong> " ) ;
16401640 write_size_of_layout ( w, ty_layout. layout , 0 ) ;
16411641 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+ {
16431645 if !variants. is_empty ( ) {
16441646 w. write_str (
16451647 "<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) {
16521654 span_bug ! ( tcx. def_span( ty_def_id) , "not an adt" )
16531655 } ;
16541656
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 {
16561660 i. size ( ) . bytes ( )
16571661 } 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" )
16591663 } ;
16601664
16611665 for ( index, layout) in variants. iter_enumerated ( ) {
0 commit comments