Skip to content

Commit 666ddd8

Browse files
committed
Don't avoid bool tags anymore to use scalar pairs for tagged enums
1 parent fd1b258 commit 666ddd8

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/librustc/ty/layout.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -988,13 +988,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
988988
let mut abi = Abi::Aggregate { sized: true };
989989
if tag.value.size(dl) == size {
990990
abi = Abi::Scalar(tag.clone());
991-
} else if !tag.is_bool() {
992-
// HACK(nox): Blindly using ScalarPair for all tagged enums
993-
// where applicable leads to Option<u8> being handled as {i1, i8},
994-
// which later confuses SROA and some loop optimisations,
995-
// ultimately leading to the repeat-trusted-len test
996-
// failing. We make the trade-off of using ScalarPair only
997-
// for types where the tag isn't a boolean.
991+
} else {
998992
let mut common_prim = None;
999993
for (field_layouts, layout_variant) in variants.iter().zip(&layout_variants) {
1000994
let offsets = match layout_variant.fields {

0 commit comments

Comments
 (0)