Skip to content

Commit b4114eb

Browse files
committed
Exposed all platform-specific documentation.
1 parent a2b8886 commit b4114eb

File tree

7 files changed

+75
-30
lines changed

7 files changed

+75
-30
lines changed

src/libstd/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@
314314
#![feature(untagged_unions)]
315315
#![feature(unwind_attributes)]
316316
#![feature(vec_push_all)]
317+
#![feature(doc_cfg)]
317318
#![cfg_attr(test, feature(update_panic_count))]
318319

319320
#![default_lib_allocator]

src/libstd/os/mod.rs

+26-16
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,36 @@
1313
#![stable(feature = "os", since = "1.0.0")]
1414
#![allow(missing_docs, bad_style, missing_debug_implementations)]
1515

16-
#[cfg(any(target_os = "redox", unix))]
16+
#[cfg(all(not(dox), any(target_os = "redox", unix)))]
1717
#[stable(feature = "rust1", since = "1.0.0")]
1818
pub use sys::ext as unix;
19-
#[cfg(windows)]
19+
#[cfg(all(not(dox), windows))]
2020
#[stable(feature = "rust1", since = "1.0.0")]
2121
pub use sys::ext as windows;
2222

23-
#[cfg(target_os = "android")] pub mod android;
24-
#[cfg(target_os = "bitrig")] pub mod bitrig;
25-
#[cfg(target_os = "dragonfly")] pub mod dragonfly;
26-
#[cfg(target_os = "freebsd")] pub mod freebsd;
27-
#[cfg(target_os = "haiku")] pub mod haiku;
28-
#[cfg(target_os = "ios")] pub mod ios;
29-
#[cfg(target_os = "linux")] pub mod linux;
30-
#[cfg(target_os = "macos")] pub mod macos;
31-
#[cfg(target_os = "nacl")] pub mod nacl;
32-
#[cfg(target_os = "netbsd")] pub mod netbsd;
33-
#[cfg(target_os = "openbsd")] pub mod openbsd;
34-
#[cfg(target_os = "solaris")] pub mod solaris;
35-
#[cfg(target_os = "emscripten")] pub mod emscripten;
36-
#[cfg(target_os = "fuchsia")] pub mod fuchsia;
23+
#[cfg(dox)]
24+
#[stable(feature = "rust1", since = "1.0.0")]
25+
pub use sys::unix_ext as unix;
26+
#[cfg(dox)]
27+
#[stable(feature = "rust1", since = "1.0.0")]
28+
pub use sys::windows_ext as windows;
29+
30+
#[cfg(any(dox, target_os = "linux"))]
31+
#[doc(cfg(target_os = "linux"))]
32+
pub mod linux;
33+
34+
#[cfg(all(not(dox), target_os = "android"))] pub mod android;
35+
#[cfg(all(not(dox), target_os = "bitrig"))] pub mod bitrig;
36+
#[cfg(all(not(dox), target_os = "dragonfly"))] pub mod dragonfly;
37+
#[cfg(all(not(dox), target_os = "freebsd"))] pub mod freebsd;
38+
#[cfg(all(not(dox), target_os = "haiku"))] pub mod haiku;
39+
#[cfg(all(not(dox), target_os = "ios"))] pub mod ios;
40+
#[cfg(all(not(dox), target_os = "macos"))] pub mod macos;
41+
#[cfg(all(not(dox), target_os = "nacl"))] pub mod nacl;
42+
#[cfg(all(not(dox), target_os = "netbsd"))] pub mod netbsd;
43+
#[cfg(all(not(dox), target_os = "openbsd"))] pub mod openbsd;
44+
#[cfg(all(not(dox), target_os = "solaris"))] pub mod solaris;
45+
#[cfg(all(not(dox), target_os = "emscripten"))] pub mod emscripten;
46+
#[cfg(all(not(dox), target_os = "fuchsia"))] pub mod fuchsia;
3747

3848
pub mod raw;

src/libstd/sys/mod.rs

+30
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,33 @@ mod imp;
4545
#[cfg(target_os = "redox")]
4646
#[path = "redox/mod.rs"]
4747
mod imp;
48+
49+
50+
// Import essential modules from both platforms when documenting.
51+
52+
#[cfg(all(dox, not(unix)))]
53+
use os::linux as platform;
54+
55+
#[cfg(all(dox, not(any(unix, target_os = "redox"))))]
56+
#[path = "unix/ext/mod.rs"]
57+
pub mod unix_ext;
58+
59+
#[cfg(all(dox, any(unix, target_os = "redox")))]
60+
pub use self::ext as unix_ext;
61+
62+
63+
#[cfg(all(dox, not(windows)))]
64+
#[macro_use]
65+
#[path = "windows/compat.rs"]
66+
mod compat;
67+
68+
#[cfg(all(dox, not(windows)))]
69+
#[path = "windows/c.rs"]
70+
mod c;
71+
72+
#[cfg(all(dox, not(windows)))]
73+
#[path = "windows/ext/mod.rs"]
74+
pub mod windows_ext;
75+
76+
#[cfg(all(dox, windows))]
77+
pub use self::ext as windows_ext;

src/libstd/sys/redox/ext/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
//! ```
2929
3030
#![stable(feature = "rust1", since = "1.0.0")]
31+
#![doc(cfg(target_os = "redox"))]
3132

3233
pub mod ffi;
3334
pub mod fs;

src/libstd/sys/unix/ext/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
//! ```
2929
3030
#![stable(feature = "rust1", since = "1.0.0")]
31+
#![doc(cfg(unix))]
3132

3233
pub mod io;
3334
pub mod ffi;

src/libstd/sys/unix/mod.rs

+15-14
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,21 @@
1313
use io::{self, ErrorKind};
1414
use libc;
1515

16-
#[cfg(target_os = "android")] pub use os::android as platform;
17-
#[cfg(target_os = "bitrig")] pub use os::bitrig as platform;
18-
#[cfg(target_os = "dragonfly")] pub use os::dragonfly as platform;
19-
#[cfg(target_os = "freebsd")] pub use os::freebsd as platform;
20-
#[cfg(target_os = "haiku")] pub use os::haiku as platform;
21-
#[cfg(target_os = "ios")] pub use os::ios as platform;
22-
#[cfg(target_os = "linux")] pub use os::linux as platform;
23-
#[cfg(target_os = "macos")] pub use os::macos as platform;
24-
#[cfg(target_os = "nacl")] pub use os::nacl as platform;
25-
#[cfg(target_os = "netbsd")] pub use os::netbsd as platform;
26-
#[cfg(target_os = "openbsd")] pub use os::openbsd as platform;
27-
#[cfg(target_os = "solaris")] pub use os::solaris as platform;
28-
#[cfg(target_os = "emscripten")] pub use os::emscripten as platform;
29-
#[cfg(target_os = "fuchsia")] pub use os::fuchsia as platform;
16+
#[cfg(any(dox, target_os = "linux"))] pub use os::linux as platform;
17+
18+
#[cfg(all(not(dox), target_os = "android"))] pub use os::android as platform;
19+
#[cfg(all(not(dox), target_os = "bitrig"))] pub use os::bitrig as platform;
20+
#[cfg(all(not(dox), target_os = "dragonfly"))] pub use os::dragonfly as platform;
21+
#[cfg(all(not(dox), target_os = "freebsd"))] pub use os::freebsd as platform;
22+
#[cfg(all(not(dox), target_os = "haiku"))] pub use os::haiku as platform;
23+
#[cfg(all(not(dox), target_os = "ios"))] pub use os::ios as platform;
24+
#[cfg(all(not(dox), target_os = "macos"))] pub use os::macos as platform;
25+
#[cfg(all(not(dox), target_os = "nacl"))] pub use os::nacl as platform;
26+
#[cfg(all(not(dox), target_os = "netbsd"))] pub use os::netbsd as platform;
27+
#[cfg(all(not(dox), target_os = "openbsd"))] pub use os::openbsd as platform;
28+
#[cfg(all(not(dox), target_os = "solaris"))] pub use os::solaris as platform;
29+
#[cfg(all(not(dox), target_os = "emscripten"))] pub use os::emscripten as platform;
30+
#[cfg(all(not(dox), target_os = "fuchsia"))] pub use os::fuchsia as platform;
3031

3132
#[macro_use]
3233
pub mod weak;

src/libstd/sys/windows/ext/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
//! platform-agnostic idioms would not normally support.
1818
1919
#![stable(feature = "rust1", since = "1.0.0")]
20+
#![doc(cfg(windows))]
2021

2122
pub mod ffi;
2223
pub mod fs;

0 commit comments

Comments
 (0)