| 
3 | 3 | #![stable(feature = "os", since = "1.0.0")]  | 
4 | 4 | #![allow(missing_docs, nonstandard_style, missing_debug_implementations)]  | 
5 | 5 | 
 
  | 
6 |  | -cfg_if::cfg_if! {  | 
7 |  | -    if #[cfg(doc)] {  | 
 | 6 | +// When documenting libstd we want to show unix/windows/linux modules as these are the "main  | 
 | 7 | +// modules" that are used across platforms, so all modules are enabled when `cfg(doc)` is set.  | 
 | 8 | +// This should help show platform-specific functionality in a hopefully cross-platform way in the  | 
 | 9 | +// documentation.  | 
 | 10 | +// Note that we deliberately avoid `cfg_if!` here to work around a rust-analyzer bug that would make  | 
 | 11 | +// `std::os` submodules unusable: https://github.com/rust-analyzer/rust-analyzer/issues/6038  | 
8 | 12 | 
 
  | 
9 |  | -        // When documenting libstd we want to show unix/windows/linux modules as  | 
10 |  | -        // these are the "main modules" that are used across platforms. This  | 
11 |  | -        // should help show platform-specific functionality in a hopefully  | 
12 |  | -        // cross-platform way in the documentation  | 
 | 13 | +#[cfg(doc)]  | 
 | 14 | +#[stable(feature = "rust1", since = "1.0.0")]  | 
 | 15 | +pub use crate::sys::unix_ext as unix;  | 
13 | 16 | 
 
  | 
14 |  | -        #[stable(feature = "rust1", since = "1.0.0")]  | 
15 |  | -        pub use crate::sys::unix_ext as unix;  | 
 | 17 | +#[cfg(doc)]  | 
 | 18 | +#[stable(feature = "rust1", since = "1.0.0")]  | 
 | 19 | +pub use crate::sys::windows_ext as windows;  | 
16 | 20 | 
 
  | 
17 |  | -        #[stable(feature = "rust1", since = "1.0.0")]  | 
18 |  | -        pub use crate::sys::windows_ext as windows;  | 
 | 21 | +#[cfg(doc)]  | 
 | 22 | +#[doc(cfg(target_os = "linux"))]  | 
 | 23 | +pub mod linux;  | 
19 | 24 | 
 
  | 
20 |  | -        #[doc(cfg(target_os = "linux"))]  | 
21 |  | -        pub mod linux;  | 
22 |  | -    } else {  | 
 | 25 | +// If we're not documenting libstd then we just expose the main modules as we otherwise would.  | 
23 | 26 | 
 
  | 
24 |  | -        // If we're not documenting libstd then we just expose the main modules  | 
25 |  | -        // as we otherwise would.  | 
 | 27 | +#[cfg(not(doc))]  | 
 | 28 | +#[cfg(any(target_os = "redox", unix, target_os = "vxworks", target_os = "hermit"))]  | 
 | 29 | +#[stable(feature = "rust1", since = "1.0.0")]  | 
 | 30 | +pub use crate::sys::ext as unix;  | 
26 | 31 | 
 
  | 
27 |  | -        #[cfg(any(target_os = "redox", unix, target_os = "vxworks", target_os = "hermit"))]  | 
28 |  | -        #[stable(feature = "rust1", since = "1.0.0")]  | 
29 |  | -        pub use crate::sys::ext as unix;  | 
 | 32 | +#[cfg(not(doc))]  | 
 | 33 | +#[cfg(windows)]  | 
 | 34 | +#[stable(feature = "rust1", since = "1.0.0")]  | 
 | 35 | +pub use crate::sys::ext as windows;  | 
30 | 36 | 
 
  | 
31 |  | -        #[cfg(windows)]  | 
32 |  | -        #[stable(feature = "rust1", since = "1.0.0")]  | 
33 |  | -        pub use crate::sys::ext as windows;  | 
34 |  | - | 
35 |  | -        #[cfg(any(target_os = "linux", target_os = "l4re"))]  | 
36 |  | -        pub mod linux;  | 
37 |  | - | 
38 |  | -    }  | 
39 |  | -}  | 
 | 37 | +#[cfg(not(doc))]  | 
 | 38 | +#[cfg(any(target_os = "linux", target_os = "l4re"))]  | 
 | 39 | +pub mod linux;  | 
40 | 40 | 
 
  | 
41 | 41 | #[cfg(target_os = "android")]  | 
42 | 42 | pub mod android;  | 
 | 
0 commit comments