mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-16 21:15:18 +03:00
Hide niches in SIMD types, too
This commit is contained in:
@@ -1092,12 +1092,7 @@ fn layout_of_uncached(&self, ty: Ty<'tcx>) -> Result<Layout<'tcx>, LayoutError<'
|
||||
hide_niches(a);
|
||||
hide_niches(b);
|
||||
}
|
||||
Abi::Vector { element, count: _ } => {
|
||||
// Until we support types other than floats and integers in SIMD,
|
||||
// `element` must already be a full for its range, so there's nothing to
|
||||
// do here.
|
||||
assert!(element.is_always_valid(dl));
|
||||
}
|
||||
Abi::Vector { element, count: _ } => hide_niches(element),
|
||||
Abi::Aggregate { sized: _ } => {}
|
||||
}
|
||||
st.largest_niche = None;
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user