rust-lang / rust-lang/rust-clippy

multiple_crate_versions triggered even when dependencies are macro-only

Open
#6,596 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Disclaimer: not sure if this is a bug but the reasoning behind multiple_crate_versions suggests so. May be hard to fix.
Lint name: multiple_crate_versions

I tried this code:
Irrelevant here, but the dependencies are relevant: multiple versions of cfg-if

I expected to see this happen: multiple versions of cfg-if should be fine because macros don't bloat binary sizes

Instead, this happened: error: multiple versions for dependency cfg-if: 0.1.10, 1.0.0

Meta

IDK, I'm filing based on this comment: https://github.com/rust-lang/log/issues/437#issuecomment-760491522

@anthraxx could you provide this information?

  • cargo clippy -V: e.g. clippy 0.0.212 (f455e46 2020-06-20)
  • rustc -Vv:
    rustc 1.46.0-nightly (f455e46ea 2020-06-20)
    binary: rustc
    commit-hash: f455e46eae1a227d735091091144601b467e1565
    commit-date: 2020-06-20
    host: x86_64-unknown-linux-gnu
    release: 1.46.0-nightly
    LLVM version: 10.0
    

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 by reproducing the multiple_crate_versions diagnostic with the macro-only cfg-if dependency versions described in the issue, using the referenced cargo clippy and rustc -Vv context. Trace how the lint classifies dependencies and confirm that macro-only dependencies no longer trigger the error while ordinary duplicate versions still do.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
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.