Skip to content

Non-additive transport features are annoying to deal with #2152

@djc

Description

@djc

Current behavior 😯

Cargo features are intended to be additive and non-additive features are making it substantially harder to deal with the gix crates. It would be very nice if the curl and reqwest backends could be rewired so that the caller must pick a backend and the crates can still be compiled if both are enabled.

(Noticed this again while working on rustsec/rustsec#1408.)

Expected behavior 🤔

Compile with --all-features without this:

error[E0428]: the name `Impl` is defined multiple times
   --> /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gix-transport-0.48.0/src/client/blocking_io/http/mod.rs:220:1
    |
217 | pub type Impl = curl::Curl;
    | --------------------------- previous definition of the type `Impl` here
...
220 | pub type Impl = reqwest::Remote;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Impl` redefined here
    |
    = note: `Impl` must be defined only once in the type namespace of this module

error: Cannot set both 'http-client-reqwest' and 'http-client-curl' features as they are mutually exclusive
  --> /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gix-transport-0.48.0/src/client/blocking_io/http/mod.rs:26:1
   |
26 | compile_error!("Cannot set both 'http-client-reqwest' and 'http-client-curl' features as they are mutually exclusive");
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0428`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    acknowledgedan issue is accepted as shortcoming to be fixedhelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions