@@ -10,117 +10,121 @@ 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;
76
-
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;
111
-
112
- #[ cfg( target_os = "vxworks" ) ]
113
- pub mod vxworks;
114
-
115
- #[ cfg( target_os = "wasi" ) ]
116
- pub mod wasi;
117
-
118
- #[ cfg( windows) ]
119
- pub mod windows;
120
- }
121
- #[ cfg( not( doc) ) ]
122
- #[ stable( feature = "os" , since = "1.0.0" ) ]
123
- pub use imp:: * ;
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 { }
54
+
55
+ // unix
56
+ #[ cfg( not( any(
57
+ all( target_arch = "wasm32" , not( target_os = "wasi" ) ) ,
58
+ all( target_vendor = "fortanix" , target_env = "sgx" )
59
+ ) ) ) ]
60
+ #[ cfg( all( not( doc) , target_os = "hermit" ) ) ]
61
+ #[ path = "hermit/mod.rs" ]
62
+ pub mod unix;
63
+ #[ cfg( not( any(
64
+ all( target_arch = "wasm32" , not( target_os = "wasi" ) ) ,
65
+ all( target_vendor = "fortanix" , target_env = "sgx" )
66
+ ) ) ) ]
67
+ #[ cfg( any( unix, doc) ) ]
68
+ pub mod unix;
69
+
70
+ // linux
71
+ #[ cfg( not( any(
72
+ all( target_arch = "wasm32" , not( target_os = "wasi" ) ) ,
73
+ all( target_vendor = "fortanix" , target_env = "sgx" )
74
+ ) ) ) ]
75
+ #[ cfg( any( target_os = "linux" , target_os = "l4re" , doc) ) ]
76
+ pub mod linux;
77
+
78
+ // wasi
79
+ #[ cfg( not( any(
80
+ all( target_arch = "wasm32" , not( target_os = "wasi" ) ) ,
81
+ all( target_vendor = "fortanix" , target_env = "sgx" )
82
+ ) ) ) ]
83
+ #[ cfg( any( target_os = "wasi" , doc) ) ]
84
+ pub mod wasi;
85
+
86
+ // windows
87
+ #[ cfg( not( any(
88
+ all( target_arch = "wasm32" , not( target_os = "wasi" ) ) ,
89
+ all( target_vendor = "fortanix" , target_env = "sgx" )
90
+ ) ) ) ]
91
+ #[ cfg( any( windows, doc) ) ]
92
+ pub mod windows;
93
+
94
+ // Others.
95
+ #[ cfg( target_os = "android" ) ]
96
+ pub mod android;
97
+ #[ cfg( target_os = "dragonfly" ) ]
98
+ pub mod dragonfly;
99
+ #[ cfg( target_os = "emscripten" ) ]
100
+ pub mod emscripten;
101
+ #[ cfg( target_os = "espidf" ) ]
102
+ pub mod espidf;
103
+ #[ cfg( all( target_vendor = "fortanix" , target_env = "sgx" ) ) ]
104
+ pub mod fortanix_sgx;
105
+ #[ cfg( target_os = "freebsd" ) ]
106
+ pub mod freebsd;
107
+ #[ cfg( target_os = "fuchsia" ) ]
108
+ pub mod fuchsia;
109
+ #[ cfg( target_os = "haiku" ) ]
110
+ pub mod haiku;
111
+ #[ cfg( target_os = "illumos" ) ]
112
+ pub mod illumos;
113
+ #[ cfg( target_os = "ios" ) ]
114
+ pub mod ios;
115
+ #[ cfg( target_os = "macos" ) ]
116
+ pub mod macos;
117
+ #[ cfg( target_os = "netbsd" ) ]
118
+ pub mod netbsd;
119
+ #[ cfg( target_os = "openbsd" ) ]
120
+ pub mod openbsd;
121
+ #[ cfg( target_os = "redox" ) ]
122
+ pub mod redox;
123
+ #[ cfg( target_os = "solaris" ) ]
124
+ pub mod solaris;
125
+
126
+ #[ cfg( target_os = "vxworks" ) ]
127
+ pub mod vxworks;
124
128
125
129
#[ cfg( any( unix, target_os = "wasi" , doc) ) ]
126
130
mod fd;
0 commit comments