rust-lang / rust-lang/rust-clippy

Cargo does not seem to always propagate `cfg(clippy)` correctly to dependencies

Open
#13,101 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

Summary

When using path dependencies in Cargo.toml, cargo does not seem to propagate the special cfg(clippy) to dependencies correctly.
A minimized example is available here.

For reference, this issue has been first opened here and then transferred to this repository.

Reproducer

In the minimized example repo, run cargo clippy --features feature1,feature2.

As far as I understand, it should not trigger a compiler error.

Version
cargo 1.81.0-nightly (154fdac39 2024-07-07)
release: 1.81.0-nightly
commit-hash: 154fdac39ae9629954e19e9986fd2cf2cdd8d964
commit-date: 2024-07-07
host: x86_64-unknown-linux-gnu
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.8.0-DEV (sys:0.4.73+curl-8.8.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Arch Linux Rolling Release [64-bit]
Additional Labels

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimized example repository linked in the issue and run cargo clippy --features feature1,feature2 using the reported setup. Trace how cfg(clippy) is propagated to the path dependencies and compare the observed compiler error with the expected behavior. Done means the reproducer no longer triggers that compiler error.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.