@@ -243,6 +243,7 @@ pub struct Cache {
243
243
244
244
stack : Vec < String > ,
245
245
parent_stack : Vec < DefId > ,
246
+ parent_is_trait_impl : bool ,
246
247
search_index : Vec < IndexItem > ,
247
248
privmod : bool ,
248
249
remove_priv : bool ,
@@ -487,6 +488,7 @@ pub fn run(mut krate: clean::Crate,
487
488
stack : Vec :: new ( ) ,
488
489
parent_stack : Vec :: new ( ) ,
489
490
search_index : Vec :: new ( ) ,
491
+ parent_is_trait_impl : false ,
490
492
extern_locations : HashMap :: new ( ) ,
491
493
primitive_locations : HashMap :: new ( ) ,
492
494
remove_priv : cx. passes . contains ( "strip-private" ) ,
@@ -996,6 +998,11 @@ impl DocFolder for Cache {
996
998
// Index this method for searching later on
997
999
if let Some ( ref s) = item. name {
998
1000
let ( parent, is_method) = match item. inner {
1001
+ clean:: AssociatedConstItem ( ..) |
1002
+ clean:: TypedefItem ( _, true ) if self . parent_is_trait_impl => {
1003
+ // skip associated items in trait impls
1004
+ ( ( None , None ) , false )
1005
+ }
999
1006
clean:: AssociatedTypeItem ( ..) |
1000
1007
clean:: AssociatedConstItem ( ..) |
1001
1008
clean:: TyMethodItem ( ..) |
@@ -1027,10 +1034,6 @@ impl DocFolder for Cache {
1027
1034
( ( Some ( * last) , path) , true )
1028
1035
}
1029
1036
}
1030
- clean:: TypedefItem ( _, true ) => {
1031
- // skip associated types in impls
1032
- ( ( None , None ) , false )
1033
- }
1034
1037
_ => ( ( None , Some ( & * self . stack ) ) , false )
1035
1038
} ;
1036
1039
let hidden_field = match item. inner {
@@ -1116,12 +1119,15 @@ impl DocFolder for Cache {
1116
1119
}
1117
1120
1118
1121
// Maintain the parent stack
1122
+ let orig_parent_is_trait_impl = self . parent_is_trait_impl ;
1119
1123
let parent_pushed = match item. inner {
1120
1124
clean:: TraitItem ( ..) | clean:: EnumItem ( ..) | clean:: StructItem ( ..) => {
1121
1125
self . parent_stack . push ( item. def_id ) ;
1126
+ self . parent_is_trait_impl = false ;
1122
1127
true
1123
1128
}
1124
1129
clean:: ImplItem ( ref i) => {
1130
+ self . parent_is_trait_impl = i. trait_ . is_some ( ) ;
1125
1131
match i. for_ {
1126
1132
clean:: ResolvedPath { did, .. } => {
1127
1133
self . parent_stack . push ( did) ;
@@ -1202,6 +1208,7 @@ impl DocFolder for Cache {
1202
1208
if pushed { self . stack . pop ( ) . unwrap ( ) ; }
1203
1209
if parent_pushed { self . parent_stack . pop ( ) . unwrap ( ) ; }
1204
1210
self . privmod = orig_privmod;
1211
+ self . parent_is_trait_impl = orig_parent_is_trait_impl;
1205
1212
return ret;
1206
1213
}
1207
1214
}
0 commit comments