@@ -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" ) ,
@@ -996,6 +998,11 @@ impl DocFolder for Cache {
996998 // Index this method for searching later on
997999 if let Some ( ref s) = item. name {
9981000 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+ }
9991006 clean:: AssociatedTypeItem ( ..) |
10001007 clean:: AssociatedConstItem ( ..) |
10011008 clean:: TyMethodItem ( ..) |
@@ -1027,10 +1034,6 @@ impl DocFolder for Cache {
10271034 ( ( Some ( * last) , path) , true )
10281035 }
10291036 }
1030- clean:: TypedefItem ( _, true ) => {
1031- // skip associated types in impls
1032- ( ( None , None ) , false )
1033- }
10341037 _ => ( ( None , Some ( & * self . stack ) ) , false )
10351038 } ;
10361039 let hidden_field = match item. inner {
@@ -1116,12 +1119,15 @@ impl DocFolder for Cache {
11161119 }
11171120
11181121 // Maintain the parent stack
1122+ let orig_parent_is_trait_impl = self . parent_is_trait_impl ;
11191123 let parent_pushed = match item. inner {
11201124 clean:: TraitItem ( ..) | clean:: EnumItem ( ..) | clean:: StructItem ( ..) => {
11211125 self . parent_stack . push ( item. def_id ) ;
1126+ self . parent_is_trait_impl = false ;
11221127 true
11231128 }
11241129 clean:: ImplItem ( ref i) => {
1130+ self . parent_is_trait_impl = i. trait_ . is_some ( ) ;
11251131 match i. for_ {
11261132 clean:: ResolvedPath { did, .. } => {
11271133 self . parent_stack . push ( did) ;
@@ -1202,6 +1208,7 @@ impl DocFolder for Cache {
12021208 if pushed { self . stack . pop ( ) . unwrap ( ) ; }
12031209 if parent_pushed { self . parent_stack . pop ( ) . unwrap ( ) ; }
12041210 self . privmod = orig_privmod;
1211+ self . parent_is_trait_impl = orig_parent_is_trait_impl;
12051212 return ret;
12061213 }
12071214}
0 commit comments