@@ -328,16 +328,20 @@ fn check_item<'tcx>(tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>) -> Result<()
328
328
hir:: ItemKind :: TraitAlias ( ..) => check_trait ( tcx, item) ,
329
329
// `ForeignItem`s are handled separately.
330
330
hir:: ItemKind :: ForeignMod { .. } => Ok ( ( ) ) ,
331
- hir:: ItemKind :: TyAlias ( hir_ty, hir_generics) => {
332
- if tcx. type_alias_is_lazy ( item. owner_id ) {
333
- // Bounds of lazy type aliases and of eager ones that contain opaque types are respected.
334
- // E.g: `type X = impl Trait;`, `type X = (impl Trait, Y);`.
335
- let res = check_item_type ( tcx, def_id, hir_ty. span , UnsizedHandling :: Allow ) ;
336
- check_variances_for_type_defn ( tcx, item, hir_generics) ;
337
- res
338
- } else {
331
+ hir:: ItemKind :: TyAlias ( hir_ty, hir_generics) if tcx. type_alias_is_lazy ( item. owner_id ) => {
332
+ let res = enter_wf_checking_ctxt ( tcx, item. span , def_id, |wfcx| {
333
+ let ty = tcx. type_of ( def_id) . instantiate_identity ( ) ;
334
+ let item_ty = wfcx. normalize ( hir_ty. span , Some ( WellFormedLoc :: Ty ( def_id) ) , ty) ;
335
+ wfcx. register_wf_obligation (
336
+ hir_ty. span ,
337
+ Some ( WellFormedLoc :: Ty ( def_id) ) ,
338
+ item_ty. into ( ) ,
339
+ ) ;
340
+ check_where_clauses ( wfcx, item. span , def_id) ;
339
341
Ok ( ( ) )
340
- }
342
+ } ) ;
343
+ check_variances_for_type_defn ( tcx, item, hir_generics) ;
344
+ res
341
345
}
342
346
_ => Ok ( ( ) ) ,
343
347
} ;
@@ -1276,7 +1280,6 @@ fn check_item_fn(
1276
1280
1277
1281
enum UnsizedHandling {
1278
1282
Forbid ,
1279
- Allow ,
1280
1283
AllowIfForeignTail ,
1281
1284
}
1282
1285
@@ -1294,7 +1297,6 @@ fn check_item_type(
1294
1297
1295
1298
let forbid_unsized = match unsized_handling {
1296
1299
UnsizedHandling :: Forbid => true ,
1297
- UnsizedHandling :: Allow => false ,
1298
1300
UnsizedHandling :: AllowIfForeignTail => {
1299
1301
let tail =
1300
1302
tcx. struct_tail_for_codegen ( item_ty, wfcx. infcx . typing_env ( wfcx. param_env ) ) ;
0 commit comments