Make constant field access account for field reordering.

This commit is contained in:
Austin Hicks 2016-11-18 13:41:21 -05:00
parent 8cfbffea3b
commit 1969aeb3d7
2 changed files with 5 additions and 10 deletions

View file

@ -26,9 +26,7 @@ fn main() {
assert_eq!(size_of::<E>(), 1);
assert_eq!(size_of::<Option<E>>(), 1);
assert_eq!(size_of::<Result<E, ()>>(), 1);
// The next asserts are correct given the currently dumb field reordering algorithm, which actually makes this struct larger.
assert_eq!(size_of::<S>(), 6);
assert_eq!(size_of::<Option<S>>(), 6);
assert_eq!(size_of::<Option<S>>(), size_of::<S>());
let enone = None::<E>;
let esome = Some(E::A);
if let Some(..) = enone {