Skip to content

Commit

Permalink
Merge pull request #2091 from smalis-msft/no-default-features
Browse files Browse the repository at this point in the history
Do not enable any features by default
  • Loading branch information
asomers committed Aug 11, 2023
2 parents 9304788 + fa71f33 commit 1fbc897
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 15 deletions.
14 changes: 7 additions & 7 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ build: &BUILD
- . $HOME/.cargo/env || true
- $TOOL -Vv
- rustc -Vv
- $TOOL $BUILD $ZFLAGS --target $TARGET --all-targets
- $TOOL doc $ZFLAGS --no-deps --target $TARGET
- $TOOL clippy $ZFLAGS --target $TARGET --all-targets -- $CLIPPYFLAGS
- $TOOL $BUILD $ZFLAGS --target $TARGET --all-targets --all-features
- $TOOL doc $ZFLAGS --no-deps --target $TARGET --all-features
- $TOOL clippy $ZFLAGS --target $TARGET --all-targets --all-features -- $CLIPPYFLAGS
- if [ -z "$NOHACK" ]; then mkdir -p $HOME/.cargo/bin; export PATH=$HOME/.cargo/bin:$PATH; fi
- if [ -z "$NOHACK" ]; then curl -LsSf https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-${HOST:-$TARGET}.tar.gz | tar xzf - -C ~/.cargo/bin; fi
- if [ -z "$NOHACK" ]; then $TOOL hack $ZFLAGS check --target $TARGET --each-feature; fi
Expand All @@ -30,7 +30,7 @@ test: &TEST
<< : *BUILD
test_script:
- . $HOME/.cargo/env || true
- $TOOL test --target $TARGET
- $TOOL test --target $TARGET --all-features

# Test FreeBSD in a full VM. Test the i686 target too, in the
# same VM. The binary will be built in 32-bit mode, but will execute on a
Expand Down Expand Up @@ -59,9 +59,9 @@ task:
<< : *TEST
i386_test_script:
- . $HOME/.cargo/env
- cargo build --target i686-unknown-freebsd
- cargo doc --no-deps --target i686-unknown-freebsd
- cargo test --target i686-unknown-freebsd
- cargo build --target i686-unknown-freebsd --all-features
- cargo doc --no-deps --target i686-unknown-freebsd --all-features
- cargo test --target i686-unknown-freebsd --all-features
i386_feature_script:
- . $HOME/.cargo/env
- if [ -z "$NOHACK" ]; then cargo hack check --each-feature --target i686-unknown-freebsd; fi
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ This project adheres to [Semantic Versioning](https://semver.org/).
([#1943](https://github.com/nix-rust/nix/pull/1943))
- `nix::socket` and `nix::select` are now available on Redox.
([#2012](https://github.com/nix-rust/nix/pull/2012))
- All features have been removed from the default set. Users will need to specify
which features they depend on in their Cargo.toml.
([#2091](https://github.com/nix-rust/nix/pull/2091))

- Implemented I/O safety. Many public functions argument and return types have
changed:
Expand Down
8 changes: 1 addition & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,7 @@ pin-utils = { version = "0.1.0", optional = true }
memoffset = { version = "0.9", optional = true }

[features]
default = [
"acct", "aio", "dir", "env", "event", "feature", "fs",
"hostname", "inotify", "ioctl", "kmod", "mman", "mount", "mqueue",
"net", "personality", "poll", "process", "pthread", "ptrace", "quota",
"reboot", "resource", "sched", "signal", "socket", "term", "time",
"ucontext", "uio", "user", "zerocopy",
]
default = []

acct = []
aio = ["pin-utils"]
Expand Down
38 changes: 37 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,43 @@
#![recursion_limit = "500"]
#![deny(unused)]
#![allow(unused_macros)]
#![cfg_attr(not(feature = "default"), allow(unused_imports))]
#![cfg_attr(
not(all(
feature = "acct",
feature = "aio",
feature = "dir",
feature = "env",
feature = "event",
feature = "feature",
feature = "fs",
feature = "hostname",
feature = "inotify",
feature = "ioctl",
feature = "kmod",
feature = "mman",
feature = "mount",
feature = "mqueue",
feature = "net",
feature = "personality",
feature = "poll",
feature = "process",
feature = "pthread",
feature = "ptrace",
feature = "quota",
feature = "reboot",
feature = "resource",
feature = "sched",
feature = "socket",
feature = "signal",
feature = "term",
feature = "time",
feature = "ucontext",
feature = "uio",
feature = "user",
feature = "zerocopy",
)),
allow(unused_imports)
)]
#![deny(unstable_features)]
#![deny(missing_copy_implementations)]
#![deny(missing_debug_implementations)]
Expand Down

0 comments on commit 1fbc897

Please sign in to comment.