From b6425d6b0e2d52075d50907d2519f18e5530945d Mon Sep 17 00:00:00 2001 From: smalis-msft <137308034+smalis-msft@users.noreply.github.com> Date: Tue, 8 Aug 2023 18:48:43 -0400 Subject: [PATCH 1/4] Do not enable any features by default --- Cargo.toml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c788b5eb0d..8cfd38fbc3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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"] From 08f393e6c239b2e55f25fddd914662e2b741246c Mon Sep 17 00:00:00 2001 From: Steven Malis Date: Wed, 9 Aug 2023 10:44:44 -0400 Subject: [PATCH 2/4] Attempt to add --all-features to CI. --- .cirrus.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 6d5402df69..5aba3473c4 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -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 @@ -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 @@ -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 From 5a17e30a5f319c0861feea6b5297634e7754ef6b Mon Sep 17 00:00:00 2001 From: Steven Malis Date: Fri, 11 Aug 2023 11:30:50 -0400 Subject: [PATCH 3/4] Rework unused_imports allow. --- src/lib.rs | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 8649a34d44..af0c67b0f3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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)] From fa71f33eee1e9a69c7383f6390b255f7256b5a85 Mon Sep 17 00:00:00 2001 From: Steven Malis Date: Fri, 11 Aug 2023 11:34:52 -0400 Subject: [PATCH 4/4] Add changelog entry. --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 308f929025..283aa183f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,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)) ### Fixed - Fix: send `ETH_P_ALL` in htons format