@@ -243,6 +243,7 @@ pub struct Cache {
243243
244244 stack : Vec < String > ,
245245 parent_stack : Vec < DefId > ,
246+ parent_is_trait_impl : bool ,
246247 search_index : Vec < IndexItem > ,
247248 privmod : bool ,
248249 remove_priv : bool ,
@@ -487,6 +488,7 @@ pub fn run(mut krate: clean::Crate,
487488 stack : Vec :: new ( ) ,
488489 parent_stack : Vec :: new ( ) ,
489490 search_index : Vec :: new ( ) ,
491+ parent_is_trait_impl : false ,
490492 extern_locations : HashMap :: new ( ) ,
491493 primitive_locations : HashMap :: new ( ) ,
492494 remove_priv : cx. passes . contains ( "strip-private" ) ,
@@ -995,6 +997,10 @@ impl DocFolder for Cache {
995997 // Index this method for searching later on
996998 if let Some ( ref s) = item. name {
997999 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+ }
9981004 clean:: AssociatedTypeItem ( ..) |
9991005 clean:: AssociatedConstItem ( ..) |
10001006 clean:: TyMethodItem ( ..) |
@@ -1115,12 +1121,15 @@ impl DocFolder for Cache {
11151121 }
11161122
11171123 // Maintain the parent stack
1124+ let orig_parent_is_trait_impl = self . parent_is_trait_impl ;
11181125 let parent_pushed = match item. inner {
11191126 clean:: TraitItem ( ..) | clean:: EnumItem ( ..) | clean:: StructItem ( ..) => {
11201127 self . parent_stack . push ( item. def_id ) ;
1128+ self . parent_is_trait_impl = false ;
11211129 true
11221130 }
11231131 clean:: ImplItem ( ref i) => {
1132+ self . parent_is_trait_impl = i. trait_ . is_some ( ) ;
11241133 match i. for_ {
11251134 clean:: ResolvedPath { did, .. } => {
11261135 self . parent_stack . push ( did) ;
@@ -1201,6 +1210,7 @@ impl DocFolder for Cache {
12011210 if pushed { self . stack . pop ( ) . unwrap ( ) ; }
12021211 if parent_pushed { self . parent_stack . pop ( ) . unwrap ( ) ; }
12031212 self . privmod = orig_privmod;
1213+ self . parent_is_trait_impl = orig_parent_is_trait_impl;
12041214 return ret;
12051215 }
12061216}
0 commit comments