@@ -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 ;
@@ -1119,13 +1117,13 @@ pub(crate) fn render_all_impls(
1119
1117
fn render_assoc_items < ' a , ' cx : ' a > (
1120
1118
cx : & ' a mut Context < ' cx > ,
1121
1119
containing_item : & ' a clean:: Item ,
1122
- it : DefId ,
1120
+ did : DefId ,
1123
1121
what : AssocItemRender < ' a > ,
1124
1122
) -> impl fmt:: Display + ' a + Captures < ' cx > {
1125
1123
let mut derefs = DefIdSet :: default ( ) ;
1126
- derefs. insert ( it ) ;
1124
+ derefs. insert ( did ) ;
1127
1125
display_fn ( move |f| {
1128
- render_assoc_items_inner ( f, cx, containing_item, it , what, & mut derefs) ;
1126
+ render_assoc_items_inner ( f, cx, containing_item, did , what, & mut derefs) ;
1129
1127
Ok ( ( ) )
1130
1128
} )
1131
1129
}
@@ -1134,46 +1132,16 @@ fn render_assoc_items_inner(
1134
1132
mut w : & mut dyn fmt:: Write ,
1135
1133
cx : & mut Context < ' _ > ,
1136
1134
containing_item : & clean:: Item ,
1137
- it : DefId ,
1135
+ did : DefId ,
1138
1136
what : AssocItemRender < ' _ > ,
1139
1137
derefs : & mut DefIdSet ,
1140
1138
) {
1141
1139
info ! ( "Documenting associated items of {:?}" , containing_item. name) ;
1142
1140
let shared = Rc :: clone ( & cx. shared ) ;
1143
- let cache = & shared. cache ;
1144
- let tcx = cx. tcx ( ) ;
1145
- let av = if let TypeAliasItem ( ait) = & * containing_item. kind &&
1146
- let aliased_clean_type = ait. item_type . as_ref ( ) . unwrap_or ( & ait. type_ ) &&
1147
- let Some ( aliased_type_defid) = aliased_clean_type. def_id ( cache) &&
1148
- let Some ( mut av) = cache. impls . get ( & aliased_type_defid) . cloned ( ) &&
1149
- let Some ( alias_def_id) = containing_item. item_id . as_def_id ( )
1150
- {
1151
- // This branch of the compiler compares types structually, but does
1152
- // not check trait bounds. That's probably fine, since type aliases
1153
- // don't normally constrain on them anyway.
1154
- // https://github.com/rust-lang/rust/issues/21903
1155
- //
1156
- // FIXME(lazy_type_alias): Once the feature is complete or stable, rewrite this to use type unification.
1157
- // Be aware of `tests/rustdoc/issue-112515-impl-ty-alias.rs` which might regress.
1158
- let aliased_ty = tcx. type_of ( alias_def_id) . skip_binder ( ) ;
1159
- let reject_cx = DeepRejectCtxt {
1160
- treat_obligation_params : TreatParams :: AsCandidateKey ,
1161
- } ;
1162
- av. retain ( |impl_| {
1163
- if let Some ( impl_def_id) = impl_. impl_item . item_id . as_def_id ( ) {
1164
- reject_cx. types_may_unify ( aliased_ty, tcx. type_of ( impl_def_id) . skip_binder ( ) )
1165
- } else {
1166
- false
1167
- }
1168
- } ) ;
1169
- av
1170
- } else {
1171
- Vec :: new ( )
1172
- } ;
1173
- let blank = Vec :: new ( ) ;
1174
- let v = cache. impls . get ( & it) . unwrap_or ( & blank) ;
1175
- let ( non_trait, traits) : ( Vec < _ > , _ ) =
1176
- v. iter ( ) . chain ( & av[ ..] ) . partition ( |i| i. inner_impl ( ) . trait_ . is_none ( ) ) ;
1141
+ let v = shared. all_impls_for_item ( containing_item, did) ;
1142
+ let v = v. as_slice ( ) ;
1143
+ let ( non_trait, traits) : ( Vec < & Impl > , _ ) =
1144
+ v. iter ( ) . partition ( |i| i. inner_impl ( ) . trait_ . is_none ( ) ) ;
1177
1145
let mut saw_impls = FxHashSet :: default ( ) ;
1178
1146
if !non_trait. is_empty ( ) {
1179
1147
let mut tmp_buf = Buffer :: html ( ) ;
0 commit comments