@@ -1257,7 +1257,7 @@ impl DocFolder for Cache {
1257
1257
clean:: FunctionItem ( ..) | clean:: ModuleItem ( ..) |
1258
1258
clean:: ForeignFunctionItem ( ..) | clean:: ForeignStaticItem ( ..) |
1259
1259
clean:: ConstantItem ( ..) | clean:: StaticItem ( ..) |
1260
- clean:: UnionItem ( ..)
1260
+ clean:: UnionItem ( ..) | clean :: ForeignTypeItem
1261
1261
if !self . stripped_mod => {
1262
1262
// Reexported items mean that the same id can show up twice
1263
1263
// in the rustdoc ast that we're looking at. We know,
@@ -1292,7 +1292,7 @@ impl DocFolder for Cache {
1292
1292
// Maintain the parent stack
1293
1293
let orig_parent_is_trait_impl = self . parent_is_trait_impl ;
1294
1294
let parent_pushed = match item. inner {
1295
- clean:: TraitItem ( ..) | clean:: EnumItem ( ..) |
1295
+ clean:: TraitItem ( ..) | clean:: EnumItem ( ..) | clean :: ForeignTypeItem |
1296
1296
clean:: StructItem ( ..) | clean:: UnionItem ( ..) => {
1297
1297
self . parent_stack . push ( item. def_id ) ;
1298
1298
self . parent_is_trait_impl = false ;
@@ -1711,6 +1711,7 @@ impl<'a> fmt::Display for Item<'a> {
1711
1711
clean:: PrimitiveItem ( ..) => write ! ( fmt, "Primitive Type " ) ?,
1712
1712
clean:: StaticItem ( ..) | clean:: ForeignStaticItem ( ..) => write ! ( fmt, "Static " ) ?,
1713
1713
clean:: ConstantItem ( ..) => write ! ( fmt, "Constant " ) ?,
1714
+ clean:: ForeignTypeItem => write ! ( fmt, "Foreign Type " ) ?,
1714
1715
_ => {
1715
1716
// We don't generate pages for any other type.
1716
1717
unreachable ! ( ) ;
@@ -1775,6 +1776,7 @@ impl<'a> fmt::Display for Item<'a> {
1775
1776
clean:: StaticItem ( ref i) | clean:: ForeignStaticItem ( ref i) =>
1776
1777
item_static ( fmt, self . cx , self . item , i) ,
1777
1778
clean:: ConstantItem ( ref c) => item_constant ( fmt, self . cx , self . item , c) ,
1779
+ clean:: ForeignTypeItem => item_foreign_type ( fmt, self . cx , self . item ) ,
1778
1780
_ => {
1779
1781
// We don't generate pages for any other type.
1780
1782
unreachable ! ( ) ;
@@ -3429,6 +3431,21 @@ fn item_typedef(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
3429
3431
render_assoc_items ( w, cx, it, it. def_id , AssocItemRender :: All )
3430
3432
}
3431
3433
3434
+ fn item_foreign_type ( w : & mut fmt:: Formatter , cx : & Context , it : & clean:: Item ) -> fmt:: Result {
3435
+ writeln ! ( w, "<pre class='rust foreigntype'>extern {{" ) ?;
3436
+ render_attributes ( w, it) ?;
3437
+ write ! (
3438
+ w,
3439
+ " {}type {};\n }}</pre>" ,
3440
+ VisSpace ( & it. visibility) ,
3441
+ it. name. as_ref( ) . unwrap( ) ,
3442
+ ) ?;
3443
+
3444
+ document ( w, cx, it) ?;
3445
+
3446
+ render_assoc_items ( w, cx, it, it. def_id , AssocItemRender :: All )
3447
+ }
3448
+
3432
3449
impl < ' a > fmt:: Display for Sidebar < ' a > {
3433
3450
fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
3434
3451
let cx = self . cx ;
@@ -3446,6 +3463,7 @@ impl<'a> fmt::Display for Sidebar<'a> {
3446
3463
clean:: UnionItem ( ..) => write ! ( fmt, "Union " ) ?,
3447
3464
clean:: EnumItem ( ..) => write ! ( fmt, "Enum " ) ?,
3448
3465
clean:: TypedefItem ( ..) => write ! ( fmt, "Type Definition " ) ?,
3466
+ clean:: ForeignTypeItem => write ! ( fmt, "Foreign Type " ) ?,
3449
3467
clean:: ModuleItem ( ..) => if it. is_crate ( ) {
3450
3468
write ! ( fmt, "Crate " ) ?;
3451
3469
} else {
@@ -3474,6 +3492,7 @@ impl<'a> fmt::Display for Sidebar<'a> {
3474
3492
clean:: EnumItem ( ref e) => sidebar_enum ( fmt, it, e) ?,
3475
3493
clean:: TypedefItem ( ref t, _) => sidebar_typedef ( fmt, it, t) ?,
3476
3494
clean:: ModuleItem ( ref m) => sidebar_module ( fmt, it, & m. items ) ?,
3495
+ clean:: ForeignTypeItem => sidebar_foreign_type ( fmt, it) ?,
3477
3496
_ => ( ) ,
3478
3497
}
3479
3498
}
@@ -3897,6 +3916,14 @@ fn sidebar_module(fmt: &mut fmt::Formatter, _it: &clean::Item,
3897
3916
Ok ( ( ) )
3898
3917
}
3899
3918
3919
+ fn sidebar_foreign_type ( fmt : & mut fmt:: Formatter , it : & clean:: Item ) -> fmt:: Result {
3920
+ let sidebar = sidebar_assoc_items ( it) ;
3921
+ if !sidebar. is_empty ( ) {
3922
+ write ! ( fmt, "<div class=\" block items\" >{}</div>" , sidebar) ?;
3923
+ }
3924
+ Ok ( ( ) )
3925
+ }
3926
+
3900
3927
impl < ' a > fmt:: Display for Source < ' a > {
3901
3928
fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
3902
3929
let Source ( s) = * self ;
0 commit comments