rust-lang / rust-lang/rust

Renamed dev-dependency overrides tool namespace

Open
#154,323 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug needs-triage
Dominant language
Rust
Stars
119k
Forks
16.2k
PR merge metrics
PR metrics pending

Description

I tried this code:

In Cargo.toml:

[package]
name = "rust-analyzer"
version = "0.1.0"
edition = "2024"

[dev-dependencies]
foo = { path = ".", package = "rust-analyzer" }

In src/lib.rs:

fn foo(#[rust_analyzer::rust_fixture] _: &str) {}

I expected to see this happen: the code should compile. rust_analyzer::rust_fixture refers to the tool namespace rust-analyzer. It's true that dependencies override tool namespaces, but the dependency has been renamed.

Instead, this happened: cargo test fails with:

error[E0433]: cannot find `rust_fixture` in `rust_analyzer`
 --> src\lib.rs:1:25
  |
1 | fn foo(#[rust_analyzer::rust_fixture] _: &str) {}
  |                         ^^^^^^^^^^^^ could not find `rust_fixture` in `rust_analyzer`

This does not happen if the dev-dependency is removed.

Meta

rustc --version --verbose:

rustc 1.96.0-nightly (b90dc1e59 2026-03-04)
binary: rustc
commit-hash: b90dc1e597db0bbc0cab0eccb39747b1a9d7e607
commit-date: 2026-03-04
host: x86_64-pc-windows-msvc
release: 1.96.0-nightly
LLVM version: 22.1.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

Reproduce the case from Cargo.toml and src/lib.rs by running cargo test with the renamed dev-dependency and rust_analyzer::rust_fixture attribute. Trace the compiler's handling of tool namespaces when a dependency uses a different package name. Done means the example compiles while preserving the existing behavior when the dependency is not renamed.

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.