diff options
author | Paul Osborne <osbpau@gmail.com> | 2016-03-04 21:46:46 -0600 |
---|---|---|
committer | Paul Osborne <osbpau@gmail.com> | 2016-03-11 00:04:23 -0600 |
commit | f590b356a4f4d7a726349882a944ca37e0895a6f (patch) | |
tree | 2128959185064e2022f54dd5dabb0efa40e2deeb /src/lib.rs | |
parent | 987dcf45d2b7fdb9fcf05b1d06ffaf58718c73d4 (diff) | |
download | nix-f590b356a4f4d7a726349882a944ca37e0895a6f.zip |
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 https://github.com/rust-lang/rust/issues/26775 it appears that
the warning in 1.7 which was to be escalated to an error is going away
but in older versions of rust it is still the case that `pub extern crate`
will not work as expected. Instead, we use a somewhat creative hack to
export the libc root as a module in nix. Down the line, it may make
sense to either eliminate the need to export libc (by chaning the ioctl
macros) or to move toward deprecated older versions of rustc.
Signed-off-by: Paul Osborne <osbpau@gmail.com>
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -16,12 +16,17 @@ extern crate bitflags; #[macro_use] extern crate cfg_if; -pub extern crate libc; - #[cfg(test)] extern crate nix_test as nixtest; -// Re-exports +// In rust 1.8+ this should be `pub extern crate libc` but prior +// to https://github.com/rust-lang/rust/issues/26775 being resolved +// it is necessary to get a little creative. +pub mod libc { + extern crate libc; + pub use self::libc::*; +} + pub use libc::{c_int, c_void}; pub use errno::Errno; |