Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate use_std cargo feature: use std instead . #1361

Merged
merged 1 commit into from
May 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ appveyor = { repository = "rust-lang/libc", project_name = "rust-lang-libs/libc"
rustc-std-workspace-core = { version = "1.0.0", optional = true }

[features]
default = ["use_std"]
use_std = []
default = ["std"]
std = []
align = []
rustc-dep-of-std = ['align', 'rustc-std-workspace-core']
extra_traits = []
# use_std is deprecated, use `std` instead
use_std = [ 'std' ]

[workspace]
members = ["libc-test"]
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ libc = "0.2"

## Features

* `use_std`: by default `libc` links to the standard library. Disable this
* `std`: by default `libc` links to the standard library. Disable this
feature remove this dependency and be able to use `libc` in `#![no_std]`
crates.

* `extra_traits`: all `struct`s implemented in `libc` are `Copy` and `Clone`.
This feature derives `Debug`, `Eq`, `Hash`, and `PartialEq`.

* **deprecated**: `use_std` is deprecated, and is equivalent to `std`.

## Rust version support

The minimum supported Rust toolchain version is **Rust 1.13.0** . APIs requiring
Expand Down
7 changes: 7 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ fn main() {
std::env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok();
let align_cargo_feature = std::env::var("CARGO_FEATURE_ALIGN").is_ok();

if std::env::var("CARGO_FEATURE_USE_STD").is_ok() {
println!(
"cargo:warning=\"libc's use_std cargo feature is deprecated since libc 0.2.55; \
please consider using the `std` cargo feature instead\""
);
}

// Rust >= 1.15 supports private module use:
if rustc_minor_ver >= 15 || rustc_dep_of_std {
println!("cargo:rustc-cfg=libc_priv_mod_use");
Expand Down
4 changes: 2 additions & 2 deletions libc-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ cc = "1.0"
ctest = "0.2"

[features]
default = [ "use_std" ]
use_std = [ "libc/use_std" ]
default = [ "std" ]
std = [ "libc/std" ]
align = [ "libc/align" ]
extra_traits = [ "libc/extra_traits" ]

Expand Down
2 changes: 1 addition & 1 deletion src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ pub const ATF_USETRAILERS: ::c_int = 0x10;
cfg_if! {
if #[cfg(target_os = "l4re")] {
// required libraries for L4Re are linked externally, ATM
} else if #[cfg(feature = "use_std")] {
} else if #[cfg(feature = "std")] {
// cargo build, don't pull in anything extra as the libstd dep
// already pulls in all libs.
} else if #[cfg(target_env = "musl")] {
Expand Down