From 2a6ca2a2a6fc4848ec37e2b59186ce14b2b1f6ac Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Fri, 5 Dec 2025 14:35:23 +0800 Subject: [PATCH 1/2] fix: compile failure that Deflate is ambiguous Signed-off-by: Xuanwo --- src/ffi/mod.rs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/ffi/mod.rs b/src/ffi/mod.rs index 6b3e0d14..39c1c17a 100644 --- a/src/ffi/mod.rs +++ b/src/ffi/mod.rs @@ -65,16 +65,34 @@ mod c; #[cfg(feature = "any_zlib")] pub use self::c::*; +// Prefer zlib-rs when both Rust backends are enabled to avoid duplicate exports. #[cfg(all(not(feature = "any_zlib"), feature = "zlib-rs"))] mod zlib_rs; #[cfg(all(not(feature = "any_zlib"), feature = "zlib-rs"))] pub use self::zlib_rs::*; -#[cfg(all(not(feature = "any_zlib"), feature = "miniz_oxide"))] +// Fallback to miniz_oxide when zlib-rs is not selected. +#[cfg(all( + not(feature = "any_zlib"), + not(feature = "zlib-rs"), + feature = "miniz_oxide" +))] mod miniz_oxide; -#[cfg(all(not(feature = "any_zlib"), feature = "miniz_oxide"))] +#[cfg(all( + not(feature = "any_zlib"), + not(feature = "zlib-rs"), + feature = "miniz_oxide" +))] pub use self::miniz_oxide::*; +// If no backend is enabled, fail fast with a clear error message. +#[cfg(all( + not(feature = "any_zlib"), + not(feature = "zlib-rs"), + not(feature = "miniz_oxide") +))] +compile_error!("No compression backend selected; enable one of `zlib`, `zlib-ng`, `zlib-rs`, or the default `rust_backend` feature."); + impl std::fmt::Debug for ErrorMessage { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { self.get().fmt(f) From 389af1fe87c2d91882f1262ac939cb34969ef39f Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Fri, 5 Dec 2025 16:25:34 +0800 Subject: [PATCH 2/2] Bump version Signed-off-by: Xuanwo --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 030c76db..4b83ffb6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "flate2" authors = ["Alex Crichton ", "Josh Triplett "] -version = "1.1.6" +version = "1.1.7" edition = "2018" license = "MIT OR Apache-2.0" readme = "README.md"