@@ -867,6 +867,12 @@ impl DocFolder for Cache {
867867 stack. pop ( ) ;
868868 self . paths . insert ( item. def_id , ( stack, item_type:: Enum ) ) ;
869869 }
870+
871+ clean:: PrimitiveItem ( ..) if item. visibility . is_some ( ) => {
872+ self . paths . insert ( item. def_id , ( self . stack . clone ( ) ,
873+ shortty ( & item) ) ) ;
874+ }
875+
870876 _ => { }
871877 }
872878
@@ -1082,21 +1088,21 @@ impl Context {
10821088 writer. flush ( )
10831089 }
10841090
1091+ // Private modules may survive the strip-private pass if they
1092+ // contain impls for public types. These modules can also
1093+ // contain items such as publicly reexported structures.
1094+ //
1095+ // External crates will provide links to these structures, so
1096+ // these modules are recursed into, but not rendered normally (a
1097+ // flag on the context).
1098+ if !self . render_redirect_pages {
1099+ self . render_redirect_pages = ignore_private_item ( & item) ;
1100+ }
1101+
10851102 match item. inner {
10861103 // modules are special because they add a namespace. We also need to
10871104 // recurse into the items of the module as well.
10881105 clean:: ModuleItem ( ..) => {
1089- // Private modules may survive the strip-private pass if they
1090- // contain impls for public types. These modules can also
1091- // contain items such as publicly reexported structures.
1092- //
1093- // External crates will provide links to these structures, so
1094- // these modules are recursed into, but not rendered normally (a
1095- // flag on the context).
1096- if !self . render_redirect_pages {
1097- self . render_redirect_pages = ignore_private_module ( & item) ;
1098- }
1099-
11001106 let name = item. name . get_ref ( ) . to_string ( ) ;
11011107 let mut item = Some ( item) ;
11021108 self . recurse ( name, |this| {
@@ -1330,7 +1336,7 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
13301336 item : & clean:: Item , items : & [ clean:: Item ] ) -> fmt:: Result {
13311337 try!( document ( w, item) ) ;
13321338 let mut indices = range ( 0 , items. len ( ) ) . filter ( |i| {
1333- !ignore_private_module ( & items[ * i] )
1339+ !ignore_private_item ( & items[ * i] )
13341340 } ) . collect :: < Vec < uint > > ( ) ;
13351341
13361342 fn cmp ( i1 : & clean:: Item , i2 : & clean:: Item , idx1 : uint , idx2 : uint ) -> Ordering {
@@ -2016,7 +2022,7 @@ impl<'a> fmt::Show for Sidebar<'a> {
20162022fn build_sidebar ( m : & clean:: Module ) -> HashMap < String , Vec < String > > {
20172023 let mut map = HashMap :: new ( ) ;
20182024 for item in m. items . iter ( ) {
2019- if ignore_private_module ( item) { continue }
2025+ if ignore_private_item ( item) { continue }
20202026
20212027 let short = shortty ( item) . to_static_str ( ) ;
20222028 let myname = match item. name {
@@ -2066,12 +2072,13 @@ fn item_primitive(w: &mut fmt::Formatter,
20662072 render_methods ( w, it)
20672073}
20682074
2069- fn ignore_private_module ( it : & clean:: Item ) -> bool {
2075+ fn ignore_private_item ( it : & clean:: Item ) -> bool {
20702076 match it. inner {
20712077 clean:: ModuleItem ( ref m) => {
20722078 ( m. items . len ( ) == 0 && it. doc_value ( ) . is_none ( ) ) ||
20732079 it. visibility != Some ( ast:: Public )
20742080 }
2081+ clean:: PrimitiveItem ( ..) => it. visibility != Some ( ast:: Public ) ,
20752082 _ => false ,
20762083 }
20772084}
0 commit comments