@@ -63,7 +63,6 @@ use rustc_span::{
63
63
use serde:: ser:: { SerializeMap , SerializeSeq } ;
64
64
use serde:: { Serialize , Serializer } ;
65
65
66
- use crate :: clean:: types:: TypeAliasItem ;
67
66
use crate :: clean:: { self , ItemId , RenderedLink , SelfTy } ;
68
67
use crate :: error:: Error ;
69
68
use crate :: formats:: cache:: Cache ;
@@ -1156,40 +1155,8 @@ fn render_assoc_items_inner(
1156
1155
info ! ( "Documenting associated items of {:?}" , containing_item. name) ;
1157
1156
let shared = Rc :: clone ( & cx. shared ) ;
1158
1157
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 ( ) ) ;
1193
1160
if !non_trait. is_empty ( ) {
1194
1161
let mut tmp_buf = Buffer :: html ( ) ;
1195
1162
let ( render_mode, id, class_html) = match what {
@@ -1218,9 +1185,6 @@ fn render_assoc_items_inner(
1218
1185
} ;
1219
1186
let mut impls_buf = Buffer :: html ( ) ;
1220
1187
for i in & non_trait {
1221
- if !saw_impls. insert ( i. def_id ( ) ) {
1222
- continue ;
1223
- }
1224
1188
render_impl (
1225
1189
& mut impls_buf,
1226
1190
cx,
@@ -1266,10 +1230,8 @@ fn render_assoc_items_inner(
1266
1230
1267
1231
let ( synthetic, concrete) : ( Vec < & Impl > , Vec < & Impl > ) =
1268
1232
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 ( ) ) ;
1273
1235
1274
1236
render_all_impls ( w, cx, containing_item, & concrete, & synthetic, & blanket_impl) ;
1275
1237
}
0 commit comments