@@ -65,16 +65,34 @@ mod c;
6565#[ cfg( feature = "any_zlib" ) ]
6666pub 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" ) ) ]
6970mod zlib_rs;
7071#[ cfg( all( not( feature = "any_zlib" ) , feature = "zlib-rs" ) ) ]
7172pub 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+ ) ) ]
7480mod 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+ ) ) ]
7686pub 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+
7896impl 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