Skip to content

Commit 2a6ca2a

Browse files
committed
fix: compile failure that Deflate is ambiguous
Signed-off-by: Xuanwo <github@xuanwo.io>
1 parent 0d0598c commit 2a6ca2a

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

src/ffi/mod.rs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,34 @@ mod c;
6565
#[cfg(feature = "any_zlib")]
6666
pub use self::c::*;
6767

68+
// Prefer zlib-rs when both Rust backends are enabled to avoid duplicate exports.
6869
#[cfg(all(not(feature = "any_zlib"), feature = "zlib-rs"))]
6970
mod zlib_rs;
7071
#[cfg(all(not(feature = "any_zlib"), feature = "zlib-rs"))]
7172
pub use self::zlib_rs::*;
7273

73-
#[cfg(all(not(feature = "any_zlib"), feature = "miniz_oxide"))]
74+
// Fallback to miniz_oxide when zlib-rs is not selected.
75+
#[cfg(all(
76+
not(feature = "any_zlib"),
77+
not(feature = "zlib-rs"),
78+
feature = "miniz_oxide"
79+
))]
7480
mod miniz_oxide;
75-
#[cfg(all(not(feature = "any_zlib"), feature = "miniz_oxide"))]
81+
#[cfg(all(
82+
not(feature = "any_zlib"),
83+
not(feature = "zlib-rs"),
84+
feature = "miniz_oxide"
85+
))]
7686
pub use self::miniz_oxide::*;
7787

88+
// If no backend is enabled, fail fast with a clear error message.
89+
#[cfg(all(
90+
not(feature = "any_zlib"),
91+
not(feature = "zlib-rs"),
92+
not(feature = "miniz_oxide")
93+
))]
94+
compile_error!("No compression backend selected; enable one of `zlib`, `zlib-ng`, `zlib-rs`, or the default `rust_backend` feature.");
95+
7896
impl std::fmt::Debug for ErrorMessage {
7997
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
8098
self.get().fmt(f)

0 commit comments

Comments
 (0)