@@ -474,8 +474,12 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
474474 }
475475 DefKind :: Fn => { } // entirely within check_item_body
476476 DefKind :: Impl { of_trait } => {
477- if of_trait && let Some ( impl_trait_ref) = tcx. impl_trait_ref ( def_id) {
478- check_impl_items_against_trait ( tcx, def_id, impl_trait_ref. instantiate_identity ( ) ) ;
477+ if of_trait && let Some ( impl_trait_header) = tcx. impl_trait_header ( def_id) {
478+ check_impl_items_against_trait (
479+ tcx,
480+ def_id,
481+ impl_trait_header. instantiate_identity ( ) ,
482+ ) ;
479483 check_on_unimplemented ( tcx, def_id) ;
480484 }
481485 }
@@ -666,19 +670,19 @@ pub(super) fn check_specialization_validity<'tcx>(
666670fn check_impl_items_against_trait < ' tcx > (
667671 tcx : TyCtxt < ' tcx > ,
668672 impl_id : LocalDefId ,
669- impl_trait_ref : ty:: TraitRef < ' tcx > ,
673+ impl_trait_header : ty:: ImplTraitHeader < ' tcx > ,
670674) {
671675 // If the trait reference itself is erroneous (so the compilation is going
672676 // to fail), skip checking the items here -- the `impl_item` table in `tcx`
673677 // isn't populated for such impls.
674- if impl_trait_ref . references_error ( ) {
678+ if impl_trait_header . references_error ( ) {
675679 return ;
676680 }
677681
678682 let impl_item_refs = tcx. associated_item_def_ids ( impl_id) ;
679683
680684 // Negative impls are not expected to have any items
681- match tcx . impl_polarity ( impl_id ) {
685+ match impl_trait_header . polarity {
682686 ty:: ImplPolarity :: Reservation | ty:: ImplPolarity :: Positive => { }
683687 ty:: ImplPolarity :: Negative => {
684688 if let [ first_item_ref, ..] = impl_item_refs {
@@ -695,7 +699,7 @@ fn check_impl_items_against_trait<'tcx>(
695699 }
696700 }
697701
698- let trait_def = tcx. trait_def ( impl_trait_ref . def_id ) ;
702+ let trait_def = tcx. trait_def ( impl_trait_header . trait_ref . def_id ) ;
699703
700704 for & impl_item in impl_item_refs {
701705 let ty_impl_item = tcx. associated_item ( impl_item) ;
@@ -714,10 +718,10 @@ fn check_impl_items_against_trait<'tcx>(
714718 ) ) ;
715719 }
716720 ty:: AssocKind :: Fn => {
717- compare_impl_method ( tcx, ty_impl_item, ty_trait_item, impl_trait_ref ) ;
721+ compare_impl_method ( tcx, ty_impl_item, ty_trait_item, impl_trait_header . trait_ref ) ;
718722 }
719723 ty:: AssocKind :: Type => {
720- compare_impl_ty ( tcx, ty_impl_item, ty_trait_item, impl_trait_ref ) ;
724+ compare_impl_ty ( tcx, ty_impl_item, ty_trait_item, impl_trait_header . trait_ref ) ;
721725 }
722726 }
723727
@@ -737,7 +741,7 @@ fn check_impl_items_against_trait<'tcx>(
737741 let mut must_implement_one_of: Option < & [ Ident ] > =
738742 trait_def. must_implement_one_of . as_deref ( ) ;
739743
740- for & trait_item_id in tcx. associated_item_def_ids ( impl_trait_ref . def_id ) {
744+ for & trait_item_id in tcx. associated_item_def_ids ( impl_trait_header . trait_ref . def_id ) {
741745 let leaf_def = ancestors. leaf_def ( tcx, trait_item_id) ;
742746
743747 let is_implemented = leaf_def
@@ -815,7 +819,7 @@ fn check_impl_items_against_trait<'tcx>(
815819
816820 if let Some ( missing_items) = must_implement_one_of {
817821 let attr_span = tcx
818- . get_attr ( impl_trait_ref . def_id , sym:: rustc_must_implement_one_of)
822+ . get_attr ( impl_trait_header . trait_ref . def_id , sym:: rustc_must_implement_one_of)
819823 . map ( |attr| attr. span ) ;
820824
821825 missing_items_must_implement_one_of_err (
0 commit comments