From 8d14ac5e55c45e0bde35586f76e7450ce519c5c8 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Mon, 11 Sep 2017 20:32:12 -0400 Subject: [PATCH 1/3] Whitespace --- src/unix/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/mod.rs b/src/unix/mod.rs index cacc393203574..52f73474f5a04 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -235,7 +235,7 @@ cfg_if! { } else if #[cfg(target_os = "l4re")] { // required libraries for L4Re are linked externally, ATM } else if #[cfg(all(not(stdbuild), feature = "use_std"))] { - // cargo build, don't pull in anything extra as the libstd dep + // cargo build, don't pull in anything extra as the libstd dep // already pulls in all libs. } else if #[cfg(any(all(target_env = "musl", not(target_arch = "mips"))))] { #[link(name = "c", kind = "static", cfg(target_feature = "crt-static"))] From 0b2fe458a1b03551d91584a110685ac9e163f04d Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Mon, 11 Sep 2017 20:31:54 -0400 Subject: [PATCH 2/3] Prune features used by stdbuild --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 3dfd4e0375f92..71681b842626d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -83,7 +83,7 @@ ))] // Attributes needed when building as part of the standard library -#![cfg_attr(stdbuild, feature(no_std, core, core_slice_ext, staged_api, custom_attribute, cfg_target_vendor))] +#![cfg_attr(stdbuild, feature(no_std, staged_api, custom_attribute))] #![cfg_attr(stdbuild, feature(link_cfg))] #![cfg_attr(stdbuild, no_std)] #![cfg_attr(stdbuild, staged_api)] From 8a7069f91e4cc61d13c237975ac3972f920ec25e Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Mon, 11 Sep 2017 20:32:18 -0400 Subject: [PATCH 3/3] Make stdbuild a cargo feature --- src/lib.rs | 14 +++++++------- src/unix/mod.rs | 2 +- src/windows.rs | 3 ++- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 71681b842626d..bc2112730daf4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -83,18 +83,18 @@ ))] // Attributes needed when building as part of the standard library -#![cfg_attr(stdbuild, feature(no_std, staged_api, custom_attribute))] -#![cfg_attr(stdbuild, feature(link_cfg))] -#![cfg_attr(stdbuild, no_std)] -#![cfg_attr(stdbuild, staged_api)] -#![cfg_attr(stdbuild, allow(warnings))] -#![cfg_attr(stdbuild, unstable(feature = "libc", +#![cfg_attr(feature = "stdbuild", feature(no_std, staged_api, custom_attribute))] +#![cfg_attr(feature = "stdbuild", feature(link_cfg))] +#![cfg_attr(feature = "stdbuild", no_std)] +#![cfg_attr(feature = "stdbuild", staged_api)] +#![cfg_attr(feature = "stdbuild", allow(warnings))] +#![cfg_attr(feature = "stdbuild", unstable(feature = "libc", reason = "use `libc` from crates.io", issue = "27783"))] #![cfg_attr(not(feature = "use_std"), no_std)] -#[cfg(all(not(stdbuild), not(dox), feature = "use_std"))] +#[cfg(all(not(dox), feature = "use_std"))] extern crate std as core; #[macro_use] mod macros; diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 52f73474f5a04..701bc3fe64b47 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -234,7 +234,7 @@ cfg_if! { // on dox builds don't pull in anything } else if #[cfg(target_os = "l4re")] { // required libraries for L4Re are linked externally, ATM - } else if #[cfg(all(not(stdbuild), feature = "use_std"))] { + } else if #[cfg(feature = "use_std")] { // cargo build, don't pull in anything extra as the libstd dep // already pulls in all libs. } else if #[cfg(any(all(target_env = "musl", not(target_arch = "mips"))))] { diff --git a/src/windows.rs b/src/windows.rs index 385b66758c1a7..bdb0e02f1b5e3 100644 --- a/src/windows.rs +++ b/src/windows.rs @@ -158,7 +158,8 @@ pub const ENOTEMPTY: ::c_int = 41; pub const EILSEQ: ::c_int = 42; pub const STRUNCATE: ::c_int = 80; -#[cfg(all(target_env = "msvc", stdbuild))] // " if " -- appease style checker +// inline comment below appeases style checker +#[cfg(all(target_env = "msvc", feature = "stdbuild"))] // " if " #[link(name = "msvcrt", cfg(not(target_feature = "crt-static")))] #[link(name = "libcmt", cfg(target_feature = "crt-static"))] extern {}