@@ -1964,25 +1964,28 @@ impl<'tcx> Ty<'tcx> {
1964
1964
let variant = def. non_enum_variant ( ) ;
1965
1965
let f0_ty = variant. fields [ FieldIdx :: from_u32 ( 0 ) ] . ty ( tcx, args) ;
1966
1966
1967
- match f0_ty. kind ( ) {
1968
- Array ( _, _) if def. repr ( ) . scalable ( ) => {
1969
- bug ! ( "Scalable SIMD should be using a slice, not array" ) ;
1967
+ if def. repr ( ) . scalable ( ) {
1968
+ match f0_ty. kind ( ) {
1969
+ Slice ( f0_elem_ty) => ( def. repr ( ) . scalable . unwrap_or ( 0 ) as u64 , * f0_elem_ty) ,
1970
+ _ => {
1971
+ bug ! ( "Scalable SIMD should be using a slice" ) ;
1972
+ }
1970
1973
}
1971
- Slice ( f0_elem_ty) if def. repr ( ) . scalable ( ) => {
1972
- ( def. repr ( ) . scalable . unwrap_or ( 0 ) as u64 , * f0_elem_ty)
1973
- }
1974
- // If the first field is an array, we assume it is the only field and its
1975
- // elements are the SIMD components.
1976
- Array ( f0_elem_ty, f0_len) => {
1977
- // FIXME(repr_simd): https://github.com/rust-lang/rust/pull/78863#discussion_r522784112
1978
- // The way we evaluate the `N` in `[T; N]` here only works since we use
1979
- // `simd_size_and_type` post-monomorphization. It will probably start to ICE
1980
- // if we use it in generic code. See the `simd-array-trait` ui test.
1981
- ( f0_len. eval_target_usize ( tcx, ParamEnv :: empty ( ) ) , * f0_elem_ty)
1974
+ } else {
1975
+ match f0_ty. kind ( ) {
1976
+ // If the first field is an array, we assume it is the only field and its
1977
+ // elements are the SIMD components.
1978
+ Array ( f0_elem_ty, f0_len) => {
1979
+ // FIXME(repr_simd): https://github.com/rust-lang/rust/pull/78863#discussion_r522784112
1980
+ // The way we evaluate the `N` in `[T; N]` here only works since we use
1981
+ // `simd_size_and_type` post-monomorphization. It will probably start to ICE
1982
+ // if we use it in generic code. See the `simd-array-trait` ui test.
1983
+ ( f0_len. eval_target_usize ( tcx, ParamEnv :: empty ( ) ) , * f0_elem_ty)
1984
+ }
1985
+ // Otherwise, the fields of this Adt are the SIMD components (and we assume they
1986
+ // all have the same type).
1987
+ _ => ( variant. fields . len ( ) as u64 , f0_ty) ,
1982
1988
}
1983
- // Otherwise, the fields of this Adt are the SIMD components (and we assume they
1984
- // all have the same type).
1985
- _ => ( variant. fields . len ( ) as u64 , f0_ty) ,
1986
1989
}
1987
1990
}
1988
1991
_ => bug ! ( "`simd_size_and_type` called on invalid type" ) ,
0 commit comments