@@ -293,25 +293,13 @@ fn check_item<'tcx>(tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>) -> Result<()
293293 }
294294 hir:: ItemKind :: Fn { ident, sig, .. } => check_item_fn ( tcx, def_id, ident, sig. decl ) ,
295295 hir:: ItemKind :: Const ( _, _, ty, _) => check_const_item ( tcx, def_id, ty. span , item. span ) ,
296- hir:: ItemKind :: Struct ( ..) => {
297- let res = check_type_defn ( tcx, item, false ) ;
298- check_variances_for_type_defn ( tcx, def_id) ;
299- res
300- }
301- hir:: ItemKind :: Union ( ..) => {
302- let res = check_type_defn ( tcx, item, true ) ;
303- check_variances_for_type_defn ( tcx, def_id) ;
304- res
305- }
306- hir:: ItemKind :: Enum ( ..) => {
307- let res = check_type_defn ( tcx, item, true ) ;
308- check_variances_for_type_defn ( tcx, def_id) ;
309- res
310- }
296+ hir:: ItemKind :: Struct ( ..) => check_type_defn ( tcx, item, false ) ,
297+ hir:: ItemKind :: Union ( ..) => check_type_defn ( tcx, item, true ) ,
298+ hir:: ItemKind :: Enum ( ..) => check_type_defn ( tcx, item, true ) ,
311299 hir:: ItemKind :: Trait ( ..) => check_trait ( tcx, item) ,
312300 hir:: ItemKind :: TraitAlias ( ..) => check_trait ( tcx, item) ,
313301 hir:: ItemKind :: TyAlias ( .., hir_ty) if tcx. type_alias_is_lazy ( item. owner_id ) => {
314- let res = enter_wf_checking_ctxt ( tcx, def_id, |wfcx| {
302+ enter_wf_checking_ctxt ( tcx, def_id, |wfcx| {
315303 let ty = tcx. type_of ( def_id) . instantiate_identity ( ) ;
316304 let item_ty =
317305 wfcx. deeply_normalize ( hir_ty. span , Some ( WellFormedLoc :: Ty ( def_id) ) , ty) ;
@@ -322,9 +310,7 @@ fn check_item<'tcx>(tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>) -> Result<()
322310 ) ;
323311 check_where_clauses ( wfcx, item. span , def_id) ;
324312 Ok ( ( ) )
325- } ) ;
326- check_variances_for_type_defn ( tcx, def_id) ;
327- res
313+ } )
328314 }
329315 _ => Ok ( ( ) ) ,
330316 }
@@ -2037,7 +2023,7 @@ fn legacy_receiver_is_implemented<'tcx>(
20372023 }
20382024}
20392025
2040- fn check_variances_for_type_defn < ' tcx > ( tcx : TyCtxt < ' tcx > , def_id : LocalDefId ) {
2026+ pub ( super ) fn check_variances_for_type_defn < ' tcx > ( tcx : TyCtxt < ' tcx > , def_id : LocalDefId ) {
20412027 match tcx. def_kind ( def_id) {
20422028 DefKind :: Enum | DefKind :: Struct | DefKind :: Union => {
20432029 // Ok
0 commit comments