File tree 2 files changed +23
-0
lines changed
compiler/rustc_ty_utils/src
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -517,6 +517,10 @@ fn layout_of_uncached<'tcx>(
517
517
pref : dl. vector_align ( size) . pref ,
518
518
} ,
519
519
)
520
+ } else if let Some ( align) = def. repr ( ) . align {
521
+ let natural_align = dl. vector_align ( size) ;
522
+ let align = natural_align. max ( AbiAndPrefAlign :: new ( align) ) ;
523
+ ( Abi :: Vector { element : e_abi, count : e_len } , align)
520
524
} else {
521
525
( Abi :: Vector { element : e_abi, count : e_len } , dl. vector_align ( size) )
522
526
} ;
Original file line number Diff line number Diff line change
1
+ //@ run-pass
2
+ // A regression test for https://github.com/rust-lang/rust/issues/130402
3
+ // Our SIMD representation did not combine correctly with the repr(align) attribute,
4
+ // and this will remain a concern regardless of what we do with SIMD types.
5
+ #![ feature( repr_simd) ]
6
+ use std:: mem:: { size_of, align_of} ;
7
+
8
+ #[ repr( simd, align( 64 ) ) ]
9
+ struct IntelsIdeaOfWhatAvx512Means ( [ u8 ; 32 ] ) ;
10
+
11
+ #[ repr( transparent) ]
12
+ struct DesignValidation ( IntelsIdeaOfWhatAvx512Means ) ;
13
+
14
+ fn main ( ) {
15
+ assert_eq ! ( 64 , size_of:: <IntelsIdeaOfWhatAvx512Means >( ) ) ;
16
+ assert_eq ! ( 64 , align_of:: <IntelsIdeaOfWhatAvx512Means >( ) ) ;
17
+ assert_eq ! ( 64 , size_of:: <DesignValidation >( ) ) ;
18
+ assert_eq ! ( 64 , align_of:: <DesignValidation >( ) ) ;
19
+ }
You can’t perform that action at this time.
0 commit comments