rust-lang / rust-lang/rust

False positive regression for `unused_crate_dependencies`

Open
#147,069 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-lints C-bug L-false-positive L-unused_crate_dependencies P-medium regression-from-stable-to-stable T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

In beta (1.91.0-beta.3 (24bb93c38 2025-09-10)), there is a false positive from the unused_crate_dependencies lint that does not happen on 1.90.

To reproduce:

  • clone https://github.com/unicode-org/icu4x at 292384d6a04746164faee7d660e75a5c7ca2b89c
  • RUSTFLAGS="-D unused_crate_dependencies" cargo check --all-features --manifest-path components/properties/Cargo.toml
  • RUSTFLAGS="-D unused_crate_dependencies" cargo +beta check --all-features --manifest-path components/properties/Cargo.toml
error: extern crate `icu_locale_core` is unused in crate `icu_properties`
 --> components/properties/src/lib.rs:5:1
  |
5 | //! Definitions of [Unicode Properties] and APIs for
  | ^
  |
  = help: remove the dependency or add `use icu_locale_core as _;` to the crate root
  = note: requested on the command line with `-D unused-crate-dependencies`

error: could not compile `icu_properties` (lib) due to 1 previous error

This crate is used, so it's regression, not a bug fix.

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

Reproduce the regression with RUSTFLAGS="-D unused_crate_dependencies" cargo +beta check --all-features --manifest-path components/properties/Cargo.toml, comparing it with the non-beta command. Start from components/properties/src/lib.rs and the unused_crate_dependencies lint; done means the used icu_locale_core dependency is no longer reported while the lint still detects genuinely unused dependencies.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.