@@ -1059,6 +1059,34 @@ fn should_encode_const(def_kind: DefKind) -> bool {
10591059 }
10601060}
10611061
1062+ fn should_encode_trait_impl_trait_tys < ' tcx > ( tcx : TyCtxt < ' tcx > , def_id : DefId ) -> bool {
1063+ if tcx. def_kind ( def_id) != DefKind :: AssocFn {
1064+ return false ;
1065+ }
1066+
1067+ let Some ( item) = tcx. opt_associated_item ( def_id) else { return false ; } ;
1068+ if item. container != ty:: AssocItemContainer :: ImplContainer {
1069+ return false ;
1070+ }
1071+
1072+ let Some ( trait_item_def_id) = item. trait_item_def_id else { return false ; } ;
1073+
1074+ // FIXME(RPITIT): This does a somewhat manual walk through the signature
1075+ // of the trait fn to look for any RPITITs, but that's kinda doing a lot
1076+ // of work. We can probably remove this when we refactor RPITITs to be
1077+ // associated types.
1078+ tcx. fn_sig ( trait_item_def_id) . skip_binder ( ) . output ( ) . walk ( ) . any ( |arg| {
1079+ if let ty:: GenericArgKind :: Type ( ty) = arg. unpack ( )
1080+ && let ty:: Projection ( data) = ty. kind ( )
1081+ && tcx. def_kind ( data. item_def_id ) == DefKind :: ImplTraitPlaceholder
1082+ {
1083+ true
1084+ } else {
1085+ false
1086+ }
1087+ } )
1088+ }
1089+
10621090impl < ' a , ' tcx > EncodeContext < ' a , ' tcx > {
10631091 fn encode_attrs ( & mut self , def_id : LocalDefId ) {
10641092 let mut attrs = self
@@ -1128,6 +1156,11 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
11281156 if let DefKind :: Trait | DefKind :: TraitAlias = def_kind {
11291157 record ! ( self . tables. super_predicates_of[ def_id] <- self . tcx. super_predicates_of( def_id) ) ;
11301158 }
1159+ if should_encode_trait_impl_trait_tys ( tcx, def_id)
1160+ && let Ok ( table) = self . tcx . collect_trait_impl_trait_tys ( def_id)
1161+ {
1162+ record ! ( self . tables. trait_impl_trait_tys[ def_id] <- table) ;
1163+ }
11311164 }
11321165 let inherent_impls = tcx. crate_inherent_impls ( ( ) ) ;
11331166 for ( def_id, implementations) in inherent_impls. inherent_impls . iter ( ) {
0 commit comments