From e9580e262bee0f8a5487f1a549feea561396eb20 Mon Sep 17 00:00:00 2001 From: Austin Hicks Date: Wed, 23 Nov 2016 16:50:36 -0500 Subject: [PATCH] Some small fixes to how structs/enums are optimized --- src/librustc/ty/layout.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index 342542edcf0..6f63b15abe8 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -585,10 +585,10 @@ impl<'a, 'gcx, 'tcx> Struct { let (optimize, sort_ascending) = match kind { StructKind::AlwaysSizedUnivariant => (can_optimize, false), - StructKind::MaybeUnsizedUnivariant => (can_optimize, true), + StructKind::MaybeUnsizedUnivariant => (can_optimize, false), StructKind::EnumVariant => { assert!(fields.len() >= 1, "Enum variants must have discriminants."); - (can_optimize, fields[0].size(dl).bytes() == 1) + (can_optimize || fields[0].size(dl).bytes() == 1, true) } };