@@ -54,7 +54,6 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
54
54
use rustc_hir:: def_id:: { DefId , DefIdSet } ;
55
55
use rustc_hir:: Mutability ;
56
56
use rustc_middle:: middle:: stability;
57
- use rustc_middle:: ty:: fast_reject:: { DeepRejectCtxt , TreatParams } ;
58
57
use rustc_middle:: ty:: TyCtxt ;
59
58
use rustc_span:: {
60
59
symbol:: { sym, Symbol } ,
@@ -63,7 +62,6 @@ use rustc_span::{
63
62
use serde:: ser:: { SerializeMap , SerializeSeq } ;
64
63
use serde:: { Serialize , Serializer } ;
65
64
66
- use crate :: clean:: types:: TypeAliasItem ;
67
65
use crate :: clean:: { self , ItemId , RenderedLink , SelfTy } ;
68
66
use crate :: error:: Error ;
69
67
use crate :: formats:: cache:: Cache ;
@@ -1155,40 +1153,8 @@ fn render_assoc_items_inner(
1155
1153
info ! ( "Documenting associated items of {:?}" , containing_item. name) ;
1156
1154
let shared = Rc :: clone ( & cx. shared ) ;
1157
1155
let cache = & shared. cache ;
1158
- let tcx = cx. tcx ( ) ;
1159
- let av = if let TypeAliasItem ( ait) = & * containing_item. kind &&
1160
- let aliased_clean_type = ait. item_type . as_ref ( ) . unwrap_or ( & ait. type_ ) &&
1161
- let Some ( aliased_type_defid) = aliased_clean_type. def_id ( cache) &&
1162
- let Some ( mut av) = cache. impls . get ( & aliased_type_defid) . cloned ( ) &&
1163
- let Some ( alias_def_id) = containing_item. item_id . as_def_id ( )
1164
- {
1165
- // This branch of the compiler compares types structually, but does
1166
- // not check trait bounds. That's probably fine, since type aliases
1167
- // don't normally constrain on them anyway.
1168
- // https://github.com/rust-lang/rust/issues/21903
1169
- //
1170
- // If that changes, then this will need to check them with type
1171
- // unification.
1172
- let aliased_ty = tcx. type_of ( alias_def_id) . skip_binder ( ) ;
1173
- let reject_cx = DeepRejectCtxt {
1174
- treat_obligation_params : TreatParams :: AsCandidateKey ,
1175
- } ;
1176
- av. retain ( |impl_| {
1177
- if let Some ( impl_def_id) = impl_. impl_item . item_id . as_def_id ( ) {
1178
- reject_cx. types_may_unify ( aliased_ty, tcx. type_of ( impl_def_id) . skip_binder ( ) )
1179
- } else {
1180
- false
1181
- }
1182
- } ) ;
1183
- av
1184
- } else {
1185
- Vec :: new ( )
1186
- } ;
1187
- let blank = Vec :: new ( ) ;
1188
- let v = cache. impls . get ( & it) . unwrap_or ( & blank) ;
1189
- let ( non_trait, traits) : ( Vec < _ > , _ ) =
1190
- v. iter ( ) . chain ( & av[ ..] ) . partition ( |i| i. inner_impl ( ) . trait_ . is_none ( ) ) ;
1191
- let mut saw_impls = FxHashSet :: default ( ) ;
1156
+ let Some ( v) = cache. impls . get ( & it) else { return } ;
1157
+ let ( non_trait, traits) : ( Vec < _ > , _ ) = v. iter ( ) . partition ( |i| i. inner_impl ( ) . trait_ . is_none ( ) ) ;
1192
1158
if !non_trait. is_empty ( ) {
1193
1159
let mut tmp_buf = Buffer :: html ( ) ;
1194
1160
let ( render_mode, id, class_html) = match what {
@@ -1217,9 +1183,6 @@ fn render_assoc_items_inner(
1217
1183
} ;
1218
1184
let mut impls_buf = Buffer :: html ( ) ;
1219
1185
for i in & non_trait {
1220
- if !saw_impls. insert ( i. def_id ( ) ) {
1221
- continue ;
1222
- }
1223
1186
render_impl (
1224
1187
& mut impls_buf,
1225
1188
cx,
@@ -1265,10 +1228,8 @@ fn render_assoc_items_inner(
1265
1228
1266
1229
let ( synthetic, concrete) : ( Vec < & Impl > , Vec < & Impl > ) =
1267
1230
traits. into_iter ( ) . partition ( |t| t. inner_impl ( ) . kind . is_auto ( ) ) ;
1268
- let ( blanket_impl, concrete) : ( Vec < & Impl > , _ ) = concrete
1269
- . into_iter ( )
1270
- . filter ( |t| saw_impls. insert ( t. def_id ( ) ) )
1271
- . partition ( |t| t. inner_impl ( ) . kind . is_blanket ( ) ) ;
1231
+ let ( blanket_impl, concrete) : ( Vec < & Impl > , _ ) =
1232
+ concrete. into_iter ( ) . partition ( |t| t. inner_impl ( ) . kind . is_blanket ( ) ) ;
1272
1233
1273
1234
render_all_impls ( w, cx, containing_item, & concrete, & synthetic, & blanket_impl) ;
1274
1235
}
0 commit comments