@@ -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" ) ,
@@ -995,6 +997,10 @@ impl DocFolder for Cache {
995
997
// Index this method for searching later on
996
998
if let Some ( ref s) = item. name {
997
999
let ( parent, is_method) = match item. inner {
1000
+ clean:: AssociatedConstItem ( ..) if self . parent_is_trait_impl => {
1001
+ // skip associated consts in trait impls
1002
+ ( ( None , None ) , false )
1003
+ }
998
1004
clean:: AssociatedTypeItem ( ..) |
999
1005
clean:: AssociatedConstItem ( ..) |
1000
1006
clean:: TyMethodItem ( ..) |
@@ -1115,12 +1121,15 @@ impl DocFolder for Cache {
1115
1121
}
1116
1122
1117
1123
// Maintain the parent stack
1124
+ let orig_parent_is_trait_impl = self . parent_is_trait_impl ;
1118
1125
let parent_pushed = match item. inner {
1119
1126
clean:: TraitItem ( ..) | clean:: EnumItem ( ..) | clean:: StructItem ( ..) => {
1120
1127
self . parent_stack . push ( item. def_id ) ;
1128
+ self . parent_is_trait_impl = false ;
1121
1129
true
1122
1130
}
1123
1131
clean:: ImplItem ( ref i) => {
1132
+ self . parent_is_trait_impl = i. trait_ . is_some ( ) ;
1124
1133
match i. for_ {
1125
1134
clean:: ResolvedPath { did, .. } => {
1126
1135
self . parent_stack . push ( did) ;
@@ -1201,6 +1210,7 @@ impl DocFolder for Cache {
1201
1210
if pushed { self . stack . pop ( ) . unwrap ( ) ; }
1202
1211
if parent_pushed { self . parent_stack . pop ( ) . unwrap ( ) ; }
1203
1212
self . privmod = orig_privmod;
1213
+ self . parent_is_trait_impl = orig_parent_is_trait_impl;
1204
1214
return ret;
1205
1215
}
1206
1216
}
0 commit comments