Skip to content

Add a default-on std feature #146

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

Merged
merged 1 commit into from
Feb 11, 2016
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
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@ sudo: required
dist: trusty
rust:
- 1.0.0
- stable
- beta
- nightly
services:
- docker
script:
- if [[ $TRAVIS_RUST_VERSION = nightly* ]]; then
sh ci/run-travis.sh;
elif [[ $TRAVIS_RUST_VERSION = "1.0.0" ]]; then
cargo build;
else
cargo build;
cargo build --no-default-features;
fi
os:
- linux
Expand Down
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ other common platform libraries.
"""

[features]
default = []
default = ["use_std"]
use_std = []
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ Next, add this to your crate root:
extern crate libc;
```

Currently libc by default links to the standard library, but if you would
instead like to use libc in a `#![no_std]` situation or crate you can request
this via:

```toml
[dependencies]
libc = { version = "0.2", default-features = false }
```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be updated to yes-std.

## What is libc?

The primary purpose of this crate is to provide all of the definitions necessary
Expand Down
4 changes: 3 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@
reason = "use `libc` from crates.io",
issue = "27783"))]

#[cfg(all(not(stdbuild), not(dox)))]
#![cfg_attr(not(feature = "use_std"), no_std)]

#[cfg(all(not(stdbuild), not(dox), feature = "use_std"))]
extern crate std as core;

#[macro_use] mod macros;
Expand Down