Skip to content

Commit 1fbc897

Browse files
authored
Merge pull request #2091 from smalis-msft/no-default-features
Do not enable any features by default
2 parents 9304788 + fa71f33 commit 1fbc897

File tree

4 files changed

+48
-15
lines changed

4 files changed

+48
-15
lines changed

.cirrus.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ build: &BUILD
1818
- . $HOME/.cargo/env || true
1919
- $TOOL -Vv
2020
- rustc -Vv
21-
- $TOOL $BUILD $ZFLAGS --target $TARGET --all-targets
22-
- $TOOL doc $ZFLAGS --no-deps --target $TARGET
23-
- $TOOL clippy $ZFLAGS --target $TARGET --all-targets -- $CLIPPYFLAGS
21+
- $TOOL $BUILD $ZFLAGS --target $TARGET --all-targets --all-features
22+
- $TOOL doc $ZFLAGS --no-deps --target $TARGET --all-features
23+
- $TOOL clippy $ZFLAGS --target $TARGET --all-targets --all-features -- $CLIPPYFLAGS
2424
- if [ -z "$NOHACK" ]; then mkdir -p $HOME/.cargo/bin; export PATH=$HOME/.cargo/bin:$PATH; fi
2525
- 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
2626
- if [ -z "$NOHACK" ]; then $TOOL hack $ZFLAGS check --target $TARGET --each-feature; fi
@@ -30,7 +30,7 @@ test: &TEST
3030
<< : *BUILD
3131
test_script:
3232
- . $HOME/.cargo/env || true
33-
- $TOOL test --target $TARGET
33+
- $TOOL test --target $TARGET --all-features
3434

3535
# Test FreeBSD in a full VM. Test the i686 target too, in the
3636
# same VM. The binary will be built in 32-bit mode, but will execute on a
@@ -59,9 +59,9 @@ task:
5959
<< : *TEST
6060
i386_test_script:
6161
- . $HOME/.cargo/env
62-
- cargo build --target i686-unknown-freebsd
63-
- cargo doc --no-deps --target i686-unknown-freebsd
64-
- cargo test --target i686-unknown-freebsd
62+
- cargo build --target i686-unknown-freebsd --all-features
63+
- cargo doc --no-deps --target i686-unknown-freebsd --all-features
64+
- cargo test --target i686-unknown-freebsd --all-features
6565
i386_feature_script:
6666
- . $HOME/.cargo/env
6767
- if [ -z "$NOHACK" ]; then cargo hack check --each-feature --target i686-unknown-freebsd; fi

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ This project adheres to [Semantic Versioning](https://semver.org/).
4545
([#1943](https://github.com/nix-rust/nix/pull/1943))
4646
- `nix::socket` and `nix::select` are now available on Redox.
4747
([#2012](https://github.com/nix-rust/nix/pull/2012))
48+
- All features have been removed from the default set. Users will need to specify
49+
which features they depend on in their Cargo.toml.
50+
([#2091](https://github.com/nix-rust/nix/pull/2091))
4851

4952
- Implemented I/O safety. Many public functions argument and return types have
5053
changed:

Cargo.toml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,7 @@ pin-utils = { version = "0.1.0", optional = true }
3434
memoffset = { version = "0.9", optional = true }
3535

3636
[features]
37-
default = [
38-
"acct", "aio", "dir", "env", "event", "feature", "fs",
39-
"hostname", "inotify", "ioctl", "kmod", "mman", "mount", "mqueue",
40-
"net", "personality", "poll", "process", "pthread", "ptrace", "quota",
41-
"reboot", "resource", "sched", "signal", "socket", "term", "time",
42-
"ucontext", "uio", "user", "zerocopy",
43-
]
37+
default = []
4438

4539
acct = []
4640
aio = ["pin-utils"]

src/lib.rs

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,43 @@
4747
#![recursion_limit = "500"]
4848
#![deny(unused)]
4949
#![allow(unused_macros)]
50-
#![cfg_attr(not(feature = "default"), allow(unused_imports))]
50+
#![cfg_attr(
51+
not(all(
52+
feature = "acct",
53+
feature = "aio",
54+
feature = "dir",
55+
feature = "env",
56+
feature = "event",
57+
feature = "feature",
58+
feature = "fs",
59+
feature = "hostname",
60+
feature = "inotify",
61+
feature = "ioctl",
62+
feature = "kmod",
63+
feature = "mman",
64+
feature = "mount",
65+
feature = "mqueue",
66+
feature = "net",
67+
feature = "personality",
68+
feature = "poll",
69+
feature = "process",
70+
feature = "pthread",
71+
feature = "ptrace",
72+
feature = "quota",
73+
feature = "reboot",
74+
feature = "resource",
75+
feature = "sched",
76+
feature = "socket",
77+
feature = "signal",
78+
feature = "term",
79+
feature = "time",
80+
feature = "ucontext",
81+
feature = "uio",
82+
feature = "user",
83+
feature = "zerocopy",
84+
)),
85+
allow(unused_imports)
86+
)]
5187
#![deny(unstable_features)]
5288
#![deny(missing_copy_implementations)]
5389
#![deny(missing_debug_implementations)]

0 commit comments

Comments
 (0)