Skip to content

zlib-rs and cloudflare_zlib features conflict #440

Closed
@fintelia

Description

@fintelia

If you try to enable both the zlib-rs and cloudflare_zlib features:

[dependencies]
flate2 = { version = "1.0.35", features = ["zlib-rs", "cloudflare_zlib"] }

Then there are some compile errors:

error[E0252]: the name `libz` is defined multiple times
   --> /home/jonathan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flate2-1.0.35/src/ffi/c.rs:412:9
    |
409 |     use libz_rs_sys as libz;
    |         ------------------- previous import of the module `libz` here
...
412 |     use cloudflare_zlib_sys as libz;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `libz` reimported here
    |
    = note: `libz` must be defined only once in the type namespace of this module
help: you can use `as` to change the binding name of the import
    |
412 |     use cloudflare_zlib_sys as other_libz;
    |                             ~~~~~~~~~~~~~
...

I believe this is can be fixed by establishing precedence between the two flags here:

flate2-rs/src/ffi/c.rs

Lines 408 to 412 in 14aec22

#[cfg(all(not(feature = "zlib-ng"), feature = "zlib-rs"))]
use libz_rs_sys as libz;
#[cfg(all(not(feature = "zlib-ng"), feature = "cloudflare_zlib"))]
use cloudflare_zlib_sys as libz;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions