diff --git a/appveyor.yml b/appveyor.yml index 07ac4a92a5ae17f28d08b356ec2000d65ac49997..fe2a332a1c425fdcc62506ea27c40c29cf7b0670 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -24,4 +24,5 @@ build: false test_script: - cargo test --target %TARGET% + - cargo test --no-default-features --target %TARGET% - cargo test --manifest-path libc-test/Cargo.toml --target %TARGET% diff --git a/ci/run.sh b/ci/run.sh index 02dd35a12bf8ecd1661b9310f27103d260fcf955..8a1d10b29edb976ef7660e1b1620904cbc23197c 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -79,4 +79,5 @@ if [ "$TARGET" = "x86_64-unknown-linux-gnux32" ]; then opt="--release" fi +cargo test $opt --no-default-features --manifest-path libc-test/Cargo.toml --target $TARGET exec cargo test $opt --manifest-path libc-test/Cargo.toml --target $TARGET diff --git a/libc-test/Cargo.toml b/libc-test/Cargo.toml index 771d3b3ff0b04bb34642f9da36f5e35da7828063..8d0f9d34e6e096e91012b8ca7a3a4a781e3f4653 100644 --- a/libc-test/Cargo.toml +++ b/libc-test/Cargo.toml @@ -4,12 +4,17 @@ version = "0.1.0" authors = ["Alex Crichton <alex@alexcrichton.com>"] build = "build.rs" -[dependencies] -libc = { path = ".." } +[dependencies.libc] +path = ".." +default-features = false [build-dependencies] ctest = { git = "https://github.com/alexcrichton/ctest" } +[features] +default = [ "use_std" ] +use_std = [ "libc/use_std" ] + [[test]] name = "main" path = "test/main.rs" @@ -19,3 +24,4 @@ harness = false name = "linux-fcntl" path = "test/linux_fcntl.rs" harness = false + diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 0d344edc5fbd2e5ae350e9d5c10d4c1781336b90..286748d72aea3c588fcc1683af5b5aaaaf5293dd 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -277,16 +277,20 @@ cfg_if! { // cargo build, don't pull in anything extra as the libstd dep // already pulls in all libs. } else if #[cfg(target_env = "musl")] { - #[link(name = "c", kind = "static", cfg(target_feature = "crt-static"))] - #[link(name = "c", cfg(not(target_feature = "crt-static")))] + #[cfg_attr(feature = "stdbuild", + link(name = "c", kind = "static", + cfg(target_feature = "crt-static")))] + #[cfg_attr(feature = "stdbuild", + link(name = "c", cfg(not(target_feature = "crt-static"))))] extern {} } else if #[cfg(target_os = "emscripten")] { #[link(name = "c")] extern {} - } else if #[cfg(all(target_os = "netbsd", target_vendor = "rumprun"))] { + } else if #[cfg(all(target_os = "netbsd"))] { // Since we don't use -nodefaultlibs on Rumprun, libc is always pulled // in automatically by the linker. We avoid passing it explicitly, as it // causes some versions of binutils to crash with an assertion failure. + #[cfg_attr(feature = "stdbuild", target_vendor = "rumprun")] #[link(name = "m")] extern {} } else if #[cfg(any(target_os = "macos",