Auto merge of #50860 - nox:big-niches-for-big-doggos-🐕, r=eddyb

Find the largest niche when computing layouts

Otherwise we end up with `Option<Option<(&(), bool)>>` unnecessarily large.
This commit is contained in:
bors 2018-05-21 01:23:15 +00:00
commit 1e508c4209
2 changed files with 77 additions and 37 deletions

View file

@ -116,4 +116,7 @@ pub fn main() {
assert_eq!(size_of::<EnumWithMaybeUninhabitedVariant<!>>(),
size_of::<EnumWithMaybeUninhabitedVariant<()>>());
assert_eq!(size_of::<NicheFilledEnumWithAbsentVariant>(), size_of::<&'static ()>());
assert_eq!(size_of::<Option<Option<(bool, &())>>>(), size_of::<(bool, &())>());
assert_eq!(size_of::<Option<Option<(&(), bool)>>>(), size_of::<(bool, &())>());
}