@@ -63,7 +63,6 @@ use rustc_span::{
6363use serde:: ser:: { SerializeMap , SerializeSeq } ;
6464use serde:: { Serialize , Serializer } ;
6565
66- use crate :: clean:: types:: TypeAliasItem ;
6766use crate :: clean:: { self , ItemId , RenderedLink , SelfTy } ;
6867use crate :: error:: Error ;
6968use crate :: formats:: cache:: Cache ;
@@ -1156,40 +1155,8 @@ fn render_assoc_items_inner(
11561155 info ! ( "Documenting associated items of {:?}" , containing_item. name) ;
11571156 let shared = Rc :: clone ( & cx. shared ) ;
11581157 let cache = & shared. cache ;
1159- let tcx = cx. tcx ( ) ;
1160- let av = if let TypeAliasItem ( ait) = & * containing_item. kind &&
1161- let aliased_clean_type = ait. item_type . as_ref ( ) . unwrap_or ( & ait. type_ ) &&
1162- let Some ( aliased_type_defid) = aliased_clean_type. def_id ( cache) &&
1163- let Some ( mut av) = cache. impls . get ( & aliased_type_defid) . cloned ( ) &&
1164- let Some ( alias_def_id) = containing_item. item_id . as_def_id ( )
1165- {
1166- // This branch of the compiler compares types structually, but does
1167- // not check trait bounds. That's probably fine, since type aliases
1168- // don't normally constrain on them anyway.
1169- // https://github.com/rust-lang/rust/issues/21903
1170- //
1171- // If that changes, then this will need to check them with type
1172- // unification.
1173- let aliased_ty = tcx. type_of ( alias_def_id) . skip_binder ( ) ;
1174- let reject_cx = DeepRejectCtxt {
1175- treat_obligation_params : TreatParams :: AsCandidateKey ,
1176- } ;
1177- av. retain ( |impl_| {
1178- if let Some ( impl_def_id) = impl_. impl_item . item_id . as_def_id ( ) {
1179- reject_cx. types_may_unify ( aliased_ty, tcx. type_of ( impl_def_id) . skip_binder ( ) )
1180- } else {
1181- false
1182- }
1183- } ) ;
1184- av
1185- } else {
1186- Vec :: new ( )
1187- } ;
1188- let blank = Vec :: new ( ) ;
1189- let v = cache. impls . get ( & it) . unwrap_or ( & blank) ;
1190- let ( non_trait, traits) : ( Vec < _ > , _ ) =
1191- v. iter ( ) . chain ( & av[ ..] ) . partition ( |i| i. inner_impl ( ) . trait_ . is_none ( ) ) ;
1192- let mut saw_impls = FxHashSet :: default ( ) ;
1158+ let Some ( v) = cache. impls . get ( & it) else { return } ;
1159+ let ( non_trait, traits) : ( Vec < _ > , _ ) = v. iter ( ) . partition ( |i| i. inner_impl ( ) . trait_ . is_none ( ) ) ;
11931160 if !non_trait. is_empty ( ) {
11941161 let mut tmp_buf = Buffer :: html ( ) ;
11951162 let ( render_mode, id, class_html) = match what {
@@ -1218,9 +1185,6 @@ fn render_assoc_items_inner(
12181185 } ;
12191186 let mut impls_buf = Buffer :: html ( ) ;
12201187 for i in & non_trait {
1221- if !saw_impls. insert ( i. def_id ( ) ) {
1222- continue ;
1223- }
12241188 render_impl (
12251189 & mut impls_buf,
12261190 cx,
@@ -1266,10 +1230,8 @@ fn render_assoc_items_inner(
12661230
12671231 let ( synthetic, concrete) : ( Vec < & Impl > , Vec < & Impl > ) =
12681232 traits. into_iter ( ) . partition ( |t| t. inner_impl ( ) . kind . is_auto ( ) ) ;
1269- let ( blanket_impl, concrete) : ( Vec < & Impl > , _ ) = concrete
1270- . into_iter ( )
1271- . filter ( |t| saw_impls. insert ( t. def_id ( ) ) )
1272- . partition ( |t| t. inner_impl ( ) . kind . is_blanket ( ) ) ;
1233+ let ( blanket_impl, concrete) : ( Vec < & Impl > , _ ) =
1234+ concrete. into_iter ( ) . partition ( |t| t. inner_impl ( ) . kind . is_blanket ( ) ) ;
12731235
12741236 render_all_impls ( w, cx, containing_item, & concrete, & synthetic, & blanket_impl) ;
12751237 }
0 commit comments