Skip to content

Commit 29aaccb

Browse files
committed
Auto merge of #288 - posborne:fix-libc-export, r=fiveop
libc: re-export libc properly With rust 1.7, the following warning was being emitted by the compiler: warning: `pub extern crate` does not work as expected and should not be used. Likely to become an error. Prefer `extern crate` and `pub use`. Based on rust-lang/rust#26775 it appears that this change is the current best approach for properly exporting the libc dependency so it may be used outside of nix. Signed-off-by: Paul Osborne <[email protected]>
2 parents d53950a + f590b35 commit 29aaccb

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/lib.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,17 @@ extern crate bitflags;
1616
#[macro_use]
1717
extern crate cfg_if;
1818

19-
pub extern crate libc;
20-
2119
#[cfg(test)]
2220
extern crate nix_test as nixtest;
2321

24-
// Re-exports
22+
// In rust 1.8+ this should be `pub extern crate libc` but prior
23+
// to https://github.com/rust-lang/rust/issues/26775 being resolved
24+
// it is necessary to get a little creative.
25+
pub mod libc {
26+
extern crate libc;
27+
pub use self::libc::*;
28+
}
29+
2530
pub use libc::{c_int, c_void};
2631
pub use errno::Errno;
2732

0 commit comments

Comments
 (0)