Hide niches in SIMD types, too

This commit is contained in:
Oli Scherer 2022-07-11 10:25:41 +00:00
parent 423915590b
commit 984db78d77
2 changed files with 9 additions and 6 deletions

View file

@ -5,6 +5,8 @@
// run-pass
#![feature(repr_simd)]
use std::cell::{UnsafeCell, RefCell, Cell};
use std::mem::size_of;
use std::num::NonZeroU32 as N32;
@ -47,4 +49,10 @@ fn main() {
trait Trait {}
assert_eq!(size_of::< UnsafeCell<&dyn Trait> >(), 16);
assert_eq!(size_of::<Option<UnsafeCell<&dyn Trait>>>(), 24); // (✗ niche opt)
#[repr(simd)]
pub struct Vec4<T>([T; 4]);
assert_eq!(size_of::< UnsafeCell<Vec4<N32>> >(), 16);
assert_eq!(size_of::<Option<UnsafeCell<Vec4<N32>>>>(), 32); // (✗ niche opt)
}