diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index e56c989b843..1915a1c8648 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -20,7 +20,7 @@ #![deny(warnings)] #![feature(box_syntax)] -#![feature(libc)] +#![cfg_attr(unix, feature(libc))] #![feature(quote)] #![feature(rustc_diagnostic_macros)] #![feature(set_stdio)] @@ -29,6 +29,7 @@ extern crate arena; extern crate getopts; extern crate graphviz; extern crate env_logger; +#[cfg(unix)] extern crate libc; extern crate rustc; extern crate rustc_allocator; diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index 2f5aac65b92..870bb01bb9f 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -16,10 +16,11 @@ #![feature(custom_attribute)] #![allow(unused_attributes)] #![feature(range_contains)] -#![feature(libc)] +#![cfg_attr(unix, feature(libc))] #![feature(conservative_impl_trait)] extern crate term; +#[cfg(unix)] extern crate libc; extern crate serialize as rustc_serialize; extern crate syntax_pos; diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index 20239e97478..15216f52d91 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -14,6 +14,7 @@ #![deny(warnings)] +#[cfg(any(target_os = "macos", target_os = "ios"))] extern crate libc; extern crate test; extern crate getopts;