Skip to content

Commit 8197a18

Browse files
josephlrnewpavlov
authored andcommitted
Add back in std-only trait definitions (#96)
1 parent a9b7f92 commit 8197a18

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

src/lib.rs

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -159,27 +159,21 @@ pub use crate::error::Error;
159159

160160
#[allow(dead_code)]
161161
mod util;
162-
// Unlike the other Unix, Fuchsia and iOS don't use the libc to make any calls.
163-
#[cfg(any(
164-
target_os = "android",
165-
target_os = "dragonfly",
166-
target_os = "emscripten",
167-
target_os = "freebsd",
168-
target_os = "haiku",
169-
target_os = "illumos",
170-
target_os = "linux",
171-
target_os = "macos",
172-
target_os = "netbsd",
173-
target_os = "openbsd",
174-
target_os = "redox",
175-
target_os = "solaris",
176-
))]
177-
#[allow(dead_code)]
178-
mod util_libc;
179162

180-
// std-only trait definitions
181-
#[cfg(feature = "std")]
182-
mod error_impls;
163+
cfg_if! {
164+
// Unlike the other Unix, Fuchsia and iOS don't use the libc to make any calls.
165+
if #[cfg(any(target_os = "android", target_os = "dragonfly", target_os = "emscripten",
166+
target_os = "freebsd", target_os = "haiku", target_os = "illumos",
167+
target_os = "linux", target_os = "macos", target_os = "netbsd",
168+
target_os = "openbsd", target_os = "redox", target_os = "solaris"))] {
169+
#[allow(dead_code)]
170+
mod util_libc;
171+
// Keep std-only trait definitions for backwards compatiblity
172+
mod error_impls;
173+
} else if #[cfg(feature = "std")] {
174+
mod error_impls;
175+
}
176+
}
183177

184178
// These targets read from a file as a fallback method.
185179
#[cfg(any(

0 commit comments

Comments
 (0)