@@ -18,8 +18,8 @@ use rustc_index::Idx;
18
18
use rustc_middle:: query:: Providers ;
19
19
use rustc_middle:: ty:: layout:: { FnAbiOf , LayoutOf , TyAndLayout } ;
20
20
use rustc_middle:: ty:: {
21
- self , Const , CoroutineArgs , CoroutineArgsExt as _, FloatTy , IntTy , PolyFnSig , Ty , TyCtxt ,
22
- TyKind , UintTy ,
21
+ self , AdtDef , Const , CoroutineArgs , CoroutineArgsExt as _, FloatTy , IntTy , PolyFnSig , Ty ,
22
+ TyCtxt , TyKind , UintTy ,
23
23
} ;
24
24
use rustc_middle:: ty:: { GenericArgsRef , ScalarInt } ;
25
25
use rustc_middle:: { bug, span_bug} ;
@@ -164,7 +164,12 @@ pub(crate) fn provide(providers: &mut Providers) {
164
164
}
165
165
}
166
166
167
- providers. layout_of = |tcx, key| {
167
+ providers. layout_of = layout_of;
168
+
169
+ fn layout_of < ' tcx > (
170
+ tcx : TyCtxt < ' tcx > ,
171
+ key : ty:: PseudoCanonicalInput < ' tcx , Ty < ' tcx > > ,
172
+ ) -> Result < TyAndLayout < ' tcx > , & ' tcx ty:: layout:: LayoutError < ' tcx > > {
168
173
// HACK(eddyb) to special-case any types at all, they must be normalized,
169
174
// but when normalization would be needed, `layout_of`'s default provider
170
175
// recurses (supposedly for caching reasons), i.e. its calls `layout_of`
@@ -174,7 +179,9 @@ pub(crate) fn provide(providers: &mut Providers) {
174
179
175
180
// HACK(eddyb) bypassing upstream `#[repr(simd)]` changes (see also
176
181
// the later comment above `check_well_formed`, for more details).
177
- let reimplement_old_style_repr_simd = match ty. kind ( ) {
182
+ let reimplement_old_style_repr_simd: Option < ( & AdtDef < ' tcx > , Ty < ' tcx > , u64 ) > = match ty
183
+ . kind ( )
184
+ {
178
185
ty:: Adt ( def, args) if def. repr ( ) . simd ( ) && !def. repr ( ) . packed ( ) && def. is_struct ( ) => {
179
186
Some ( def. non_enum_variant ( ) ) . and_then ( |v| {
180
187
let ( count, e_ty) = v
@@ -268,7 +275,7 @@ pub(crate) fn provide(providers: &mut Providers) {
268
275
}
269
276
270
277
Ok ( TyAndLayout { ty, layout } )
271
- } ;
278
+ }
272
279
273
280
// HACK(eddyb) work around https://github.com/rust-lang/rust/pull/129403
274
281
// banning "struct-style" `#[repr(simd)]` (in favor of "array-newtype-style"),
0 commit comments