@@ -867,6 +867,12 @@ impl DocFolder for Cache {
867
867
stack. pop ( ) ;
868
868
self . paths . insert ( item. def_id , ( stack, item_type:: Enum ) ) ;
869
869
}
870
+
871
+ clean:: PrimitiveItem ( ..) if item. visibility . is_some ( ) => {
872
+ self . paths . insert ( item. def_id , ( self . stack . clone ( ) ,
873
+ shortty ( & item) ) ) ;
874
+ }
875
+
870
876
_ => { }
871
877
}
872
878
@@ -1082,21 +1088,21 @@ impl Context {
1082
1088
writer. flush ( )
1083
1089
}
1084
1090
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
+
1085
1102
match item. inner {
1086
1103
// modules are special because they add a namespace. We also need to
1087
1104
// recurse into the items of the module as well.
1088
1105
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
-
1100
1106
let name = item. name . get_ref ( ) . to_string ( ) ;
1101
1107
let mut item = Some ( item) ;
1102
1108
self . recurse ( name, |this| {
@@ -1330,7 +1336,7 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
1330
1336
item : & clean:: Item , items : & [ clean:: Item ] ) -> fmt:: Result {
1331
1337
try!( document ( w, item) ) ;
1332
1338
let mut indices = range ( 0 , items. len ( ) ) . filter ( |i| {
1333
- !ignore_private_module ( & items[ * i] )
1339
+ !ignore_private_item ( & items[ * i] )
1334
1340
} ) . collect :: < Vec < uint > > ( ) ;
1335
1341
1336
1342
fn cmp ( i1 : & clean:: Item , i2 : & clean:: Item , idx1 : uint , idx2 : uint ) -> Ordering {
@@ -2016,7 +2022,7 @@ impl<'a> fmt::Show for Sidebar<'a> {
2016
2022
fn build_sidebar ( m : & clean:: Module ) -> HashMap < String , Vec < String > > {
2017
2023
let mut map = HashMap :: new ( ) ;
2018
2024
for item in m. items . iter ( ) {
2019
- if ignore_private_module ( item) { continue }
2025
+ if ignore_private_item ( item) { continue }
2020
2026
2021
2027
let short = shortty ( item) . to_static_str ( ) ;
2022
2028
let myname = match item. name {
@@ -2066,12 +2072,13 @@ fn item_primitive(w: &mut fmt::Formatter,
2066
2072
render_methods ( w, it)
2067
2073
}
2068
2074
2069
- fn ignore_private_module ( it : & clean:: Item ) -> bool {
2075
+ fn ignore_private_item ( it : & clean:: Item ) -> bool {
2070
2076
match it. inner {
2071
2077
clean:: ModuleItem ( ref m) => {
2072
2078
( m. items . len ( ) == 0 && it. doc_value ( ) . is_none ( ) ) ||
2073
2079
it. visibility != Some ( ast:: Public )
2074
2080
}
2081
+ clean:: PrimitiveItem ( ..) => it. visibility != Some ( ast:: Public ) ,
2075
2082
_ => false ,
2076
2083
}
2077
2084
}
0 commit comments