diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5a50b64a..414ddf93 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -46,7 +46,7 @@ jobs: - run: cargo test --features cloudflare_zlib --no-default-features if: matrix.build != 'mingw' - run: | - if ! cargo check --no-default-features 2>&1 | grep "You need to choose" ; then + if (! cargo check --no-default-features 2>&1 | grep "You need to choose") ; then echo "expected message stating a zlib backend must be chosen" exit 1 fi diff --git a/Cargo.toml b/Cargo.toml index 10cf92ec..0dbe5397 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,13 +32,14 @@ quickcheck = { version = "1.0", default-features = false } [features] default = ["rust_backend"] -any_zlib = [] # note: this is not a real user-facing feature +any_zlib = ["any_impl"] # note: this is not a real user-facing feature +any_impl = [] # note: this is not a real user-facing feature zlib = ["any_zlib", "libz-sys"] zlib-default = ["any_zlib", "libz-sys/default"] zlib-ng-compat = ["zlib", "libz-sys/zlib-ng"] zlib-ng = ["any_zlib", "libz-ng-sys"] cloudflare_zlib = ["any_zlib", "cloudflare-zlib-sys"] -rust_backend = ["miniz_oxide"] +rust_backend = ["miniz_oxide", "any_impl"] miniz-sys = ["rust_backend"] # For backwards compatibility [package.metadata.docs.rs] diff --git a/src/ffi/mod.rs b/src/ffi/mod.rs index 8bac6e42..20b3cae6 100644 --- a/src/ffi/mod.rs +++ b/src/ffi/mod.rs @@ -40,9 +40,9 @@ mod c; #[cfg(feature = "any_zlib")] pub use self::c::*; -#[cfg(not(feature = "any_zlib"))] +#[cfg(all(not(feature = "any_zlib"), feature = "miniz_oxide"))] mod rust; -#[cfg(not(feature = "any_zlib"))] +#[cfg(all(not(feature = "any_zlib"), feature = "miniz_oxide"))] pub use self::rust::*; impl std::fmt::Debug for ErrorMessage { diff --git a/src/lib.rs b/src/lib.rs index b84865e9..738875c5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -78,6 +78,9 @@ #![cfg_attr(test, deny(warnings))] #![cfg_attr(docsrs, feature(doc_auto_cfg))] +#[cfg(not(feature = "any_impl",))] +compile_error!("You need to choose a zlib backend"); + pub use crate::crc::{Crc, CrcReader, CrcWriter}; pub use crate::gz::GzBuilder; pub use crate::gz::GzHeader;