Skip to content

Cargo passes a nonexistent feature to rustc when building gitoxide #12336

Open
@Shnatsel

Description

@Shnatsel

Problem

When running cargo build on https://github.com/Byron/gitoxide Cargo passes a nonexistent feature to rustc: --cfg 'feature="prodash"'. There is no feature prodash in any Cargo.toml, which can be confirmed with rg -t toml prodash.

This breaks cargo auditable which relies on all features passed as --cfg to rustc actually existing in the project. This also breaks builds for some Linux distributions that use cargo auditable, namely Void Linux and NixOS.

When the feature prodash is passed to cargo metadata, the following error is printed:

error: Package `gix-features v0.31.0 (/home/redacted/gitoxide/gix-features)` does not have feature `prodash`. It has an optional dependency with that name, but that dependency uses the "dep:" syntax in the features table, so it does not have an implicit feature with that name.

Steps

git clone https://github.com/Byron/gitoxide
cd gitoxide
git checkout b19a56dcfa9bea86332a84aa4e8fad445e7d1724 # current master
cargo build --verbose

Observe --cfg 'feature="prodash"' appearing in the output even though there is no such feature in any Cargo.toml, which can be confirmed with rg -t toml prodash.

The bug can also be reproduced by running cargo install cargo-auditable; cargo auditable build in the same directory.

I have tried to create a minimal reproducing example that does not rely on the gitoxide repo, but failed.

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.70.0 (ec8a8a0ca 2023-04-25)
release: 1.70.0
commit-hash: ec8a8a0cabb0e0cadef58902470f6c7ee7868bdc
commit-date: 2023-04-25
host: x86_64-unknown-linux-gnu
libgit2: 1.6.3 (sys:0.17.0 vendored)
libcurl: 8.0.1-DEV (sys:0.4.61+curl-8.0.1 vendored ssl:OpenSSL/1.1.1t)
os: Linux 7 (horus) [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cargo-apiArea: cargo-the-library API and internal code issuesA-features2Area: issues specifically related to the v2 feature resolverC-bugCategory: bugS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions