about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2021-09-28 00:00:00 +0000
committerTomasz Miąsko <tomasz.miasko@gmail.com>2021-09-28 00:00:00 +0000
commit25b6f9b68b6ff4bdcce01feaa5259ff2786c4851 (patch)
treee9bb1d7724e40a72ed2afb80d78681091d97f9da /compiler
parent1d71ba862309d59df710078a845c8772ffb22aba (diff)
downloadrust-25b6f9b68b6ff4bdcce01feaa5259ff2786c4851.tar.gz
rust-25b6f9b68b6ff4bdcce01feaa5259ff2786c4851.zip
print-type-sizes: skip field printing for primitives
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_middle/src/ty/layout.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs
index cfbbec374a1..2c3c21e7a39 100644
--- a/compiler/rustc_middle/src/ty/layout.rs
+++ b/compiler/rustc_middle/src/ty/layout.rs
@@ -1805,8 +1805,11 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
 
         match layout.variants {
             Variants::Single { index } => {
-                debug!("print-type-size `{:#?}` variant {}", layout, adt_def.variants[index].ident);
-                if !adt_def.variants.is_empty() {
+                if !adt_def.variants.is_empty() && layout.fields != FieldsShape::Primitive {
+                    debug!(
+                        "print-type-size `{:#?}` variant {}",
+                        layout, adt_def.variants[index].ident
+                    );
                     let variant_def = &adt_def.variants[index];
                     let fields: Vec<_> = variant_def.fields.iter().map(|f| f.ident.name).collect();
                     record(