Make stdbuild a cargo feature

This commit is contained in:
Tamir Duberstein 2017-09-11 20:32:18 -04:00
parent 0b2fe458a1
commit 8a7069f91e
No known key found for this signature in database
GPG Key ID: 1C1E98CC8E17BB89
3 changed files with 10 additions and 9 deletions

View File

@ -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;

View File

@ -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"))))] {

View File

@ -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 {}