@@ -10,117 +10,136 @@ pub mod raw;
10
10
// of a macro that is not vendored by Rust and included in the toolchain.
11
11
// See https://github.com/rust-analyzer/rust-analyzer/issues/6038.
12
12
13
+ // On certain platforms right now the "main modules" modules that are
14
+ // documented don't compile (missing things in `libc` which is empty),
15
+ // so just omit them with an empty module and add the "unstable" attribute.
16
+
17
+ // Unix, linux, wasi and windows are handled a bit differently.
13
18
#[ cfg( all(
14
19
doc,
15
- not ( any(
20
+ any(
16
21
all( target_arch = "wasm32" , not( target_os = "wasi" ) ) ,
17
22
all( target_vendor = "fortanix" , target_env = "sgx" )
18
- ) )
23
+ )
19
24
) ) ]
20
- #[ path = "." ]
21
- mod doc {
22
- // When documenting std we want to show the `unix`, `windows`, `linux` and `wasi`
23
- // modules as these are the "main modules" that are used across platforms,
24
- // so these modules are enabled when `cfg(doc)` is set.
25
- // This should help show platform-specific functionality in a hopefully cross-platform
26
- // way in the documentation.
27
-
28
- pub mod unix;
29
-
30
- pub mod linux;
31
-
32
- pub mod wasi;
33
-
34
- pub mod windows;
35
- }
25
+ #[ unstable( issue = "none" , feature = "std_internals" ) ]
26
+ pub mod unix { }
36
27
#[ cfg( all(
37
28
doc,
38
29
any(
39
30
all( target_arch = "wasm32" , not( target_os = "wasi" ) ) ,
40
31
all( target_vendor = "fortanix" , target_env = "sgx" )
41
32
)
42
33
) ) ]
43
- mod doc {
44
- // On certain platforms right now the "main modules" modules that are
45
- // documented don't compile (missing things in `libc` which is empty),
46
- // so just omit them with an empty module.
47
-
48
- #[ unstable( issue = "none" , feature = "std_internals" ) ]
49
- pub mod unix { }
50
-
51
- #[ unstable( issue = "none" , feature = "std_internals" ) ]
52
- pub mod linux { }
53
-
54
- #[ unstable( issue = "none" , feature = "std_internals" ) ]
55
- pub mod wasi { }
56
-
57
- #[ unstable( issue = "none" , feature = "std_internals" ) ]
58
- pub mod windows { }
59
- }
60
- #[ cfg( doc) ]
61
- #[ stable( feature = "os" , since = "1.0.0" ) ]
62
- pub use doc:: * ;
63
-
64
- #[ cfg( not( doc) ) ]
65
- #[ path = "." ]
66
- mod imp {
67
- // If we're not documenting std then we only expose modules appropriate for the
68
- // current platform.
69
-
70
- #[ cfg( all( target_vendor = "fortanix" , target_env = "sgx" ) ) ]
71
- pub mod fortanix_sgx;
72
-
73
- #[ cfg( target_os = "hermit" ) ]
74
- #[ path = "hermit/mod.rs" ]
75
- pub mod unix;
34
+ #[ unstable( issue = "none" , feature = "std_internals" ) ]
35
+ pub mod linux { }
36
+ #[ cfg( all(
37
+ doc,
38
+ any(
39
+ all( target_arch = "wasm32" , not( target_os = "wasi" ) ) ,
40
+ all( target_vendor = "fortanix" , target_env = "sgx" )
41
+ )
42
+ ) ) ]
43
+ #[ unstable( issue = "none" , feature = "std_internals" ) ]
44
+ pub mod wasi { }
45
+ #[ cfg( all(
46
+ doc,
47
+ any(
48
+ all( target_arch = "wasm32" , not( target_os = "wasi" ) ) ,
49
+ all( target_vendor = "fortanix" , target_env = "sgx" )
50
+ )
51
+ ) ) ]
52
+ #[ unstable( issue = "none" , feature = "std_internals" ) ]
53
+ pub mod windows { }
76
54
77
- #[ cfg( target_os = "android" ) ]
78
- pub mod android;
79
- #[ cfg( target_os = "dragonfly" ) ]
80
- pub mod dragonfly;
81
- #[ cfg( target_os = "emscripten" ) ]
82
- pub mod emscripten;
83
- #[ cfg( target_os = "espidf" ) ]
84
- pub mod espidf;
85
- #[ cfg( target_os = "freebsd" ) ]
86
- pub mod freebsd;
87
- #[ cfg( target_os = "fuchsia" ) ]
88
- pub mod fuchsia;
89
- #[ cfg( target_os = "haiku" ) ]
90
- pub mod haiku;
91
- #[ cfg( target_os = "illumos" ) ]
92
- pub mod illumos;
93
- #[ cfg( target_os = "ios" ) ]
94
- pub mod ios;
95
- #[ cfg( target_os = "l4re" ) ]
96
- pub mod linux;
97
- #[ cfg( target_os = "linux" ) ]
98
- pub mod linux;
99
- #[ cfg( target_os = "macos" ) ]
100
- pub mod macos;
101
- #[ cfg( target_os = "netbsd" ) ]
102
- pub mod netbsd;
103
- #[ cfg( target_os = "openbsd" ) ]
104
- pub mod openbsd;
105
- #[ cfg( target_os = "redox" ) ]
106
- pub mod redox;
107
- #[ cfg( target_os = "solaris" ) ]
108
- pub mod solaris;
109
- #[ cfg( unix) ]
110
- pub mod unix;
55
+ // unix
56
+ #[ cfg( not( all(
57
+ doc,
58
+ any(
59
+ all( target_arch = "wasm32" , not( target_os = "wasi" ) ) ,
60
+ all( target_vendor = "fortanix" , target_env = "sgx" )
61
+ )
62
+ ) ) ) ]
63
+ #[ cfg( target_os = "hermit" ) ]
64
+ #[ path = "hermit/mod.rs" ]
65
+ pub mod unix;
66
+ #[ cfg( not( all(
67
+ doc,
68
+ any(
69
+ all( target_arch = "wasm32" , not( target_os = "wasi" ) ) ,
70
+ all( target_vendor = "fortanix" , target_env = "sgx" )
71
+ )
72
+ ) ) ) ]
73
+ #[ cfg( all( not( target_os = "hermit" ) , any( unix, doc) ) ) ]
74
+ pub mod unix;
111
75
112
- #[ cfg( target_os = "vxworks" ) ]
113
- pub mod vxworks;
76
+ // linux
77
+ #[ cfg( not( all(
78
+ doc,
79
+ any(
80
+ all( target_arch = "wasm32" , not( target_os = "wasi" ) ) ,
81
+ all( target_vendor = "fortanix" , target_env = "sgx" )
82
+ )
83
+ ) ) ) ]
84
+ #[ cfg( any( target_os = "linux" , target_os = "l4re" , doc) ) ]
85
+ pub mod linux;
114
86
115
- #[ cfg( target_os = "wasi" ) ]
116
- pub mod wasi;
87
+ // wasi
88
+ #[ cfg( not( all(
89
+ doc,
90
+ any(
91
+ all( target_arch = "wasm32" , not( target_os = "wasi" ) ) ,
92
+ all( target_vendor = "fortanix" , target_env = "sgx" )
93
+ )
94
+ ) ) ) ]
95
+ #[ cfg( any( target_os = "wasi" , doc) ) ]
96
+ pub mod wasi;
117
97
118
- #[ cfg( windows) ]
119
- pub mod windows;
120
- }
121
- #[ cfg( not( doc) ) ]
122
- #[ stable( feature = "os" , since = "1.0.0" ) ]
123
- pub use imp:: * ;
98
+ // windows
99
+ #[ cfg( not( all(
100
+ doc,
101
+ any(
102
+ all( target_arch = "wasm32" , not( target_os = "wasi" ) ) ,
103
+ all( target_vendor = "fortanix" , target_env = "sgx" )
104
+ )
105
+ ) ) ) ]
106
+ #[ cfg( any( windows, doc) ) ]
107
+ pub mod windows;
108
+
109
+ // Others.
110
+ #[ cfg( target_os = "android" ) ]
111
+ pub mod android;
112
+ #[ cfg( target_os = "dragonfly" ) ]
113
+ pub mod dragonfly;
114
+ #[ cfg( target_os = "emscripten" ) ]
115
+ pub mod emscripten;
116
+ #[ cfg( target_os = "espidf" ) ]
117
+ pub mod espidf;
118
+ #[ cfg( all( target_vendor = "fortanix" , target_env = "sgx" ) ) ]
119
+ pub mod fortanix_sgx;
120
+ #[ cfg( target_os = "freebsd" ) ]
121
+ pub mod freebsd;
122
+ #[ cfg( target_os = "fuchsia" ) ]
123
+ pub mod fuchsia;
124
+ #[ cfg( target_os = "haiku" ) ]
125
+ pub mod haiku;
126
+ #[ cfg( target_os = "illumos" ) ]
127
+ pub mod illumos;
128
+ #[ cfg( target_os = "ios" ) ]
129
+ pub mod ios;
130
+ #[ cfg( target_os = "macos" ) ]
131
+ pub mod macos;
132
+ #[ cfg( target_os = "netbsd" ) ]
133
+ pub mod netbsd;
134
+ #[ cfg( target_os = "openbsd" ) ]
135
+ pub mod openbsd;
136
+ #[ cfg( target_os = "redox" ) ]
137
+ pub mod redox;
138
+ #[ cfg( target_os = "solaris" ) ]
139
+ pub mod solaris;
140
+
141
+ #[ cfg( target_os = "vxworks" ) ]
142
+ pub mod vxworks;
124
143
125
144
#[ cfg( any( unix, target_os = "wasi" , doc) ) ]
126
145
mod fd;
0 commit comments