rust-lang / rust-lang/rust-analyzer

dev-dependencies on workspace member cause cyclic dependency issues

Open
#14,167 31 comments 21 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-cargo C-tracking-issue S-unactionable
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

Note: We (rust-analyzer) consider this issue resolved in terms of what we can do here.

This issue is spread across several others, so let's make one big one out of it to better track it.

https://github.com/rust-lang/rust-analyzer/issues/2414#issuecomment-561213070

Yeah, the problem is that a crate can have a dev-dep onto itself:

[package]
name = "foo"
version = "0.1.0"
edition = "2018"

[dev-dependencies]
foo = { path = "." }

The solution here is to start "duplicating" crates when lowering cargo-metada output to CrateGraph. In the above example, we should construct two foo crates, one with cfg(test) and one without, and make the required depednency edge.

Issues in question:
https://github.com/rust-lang/rust-analyzer/issues/8330
https://github.com/rust-lang/rust-analyzer/issues/2414
https://github.com/rust-lang/rust-analyzer/issues/12407
https://github.com/rust-lang/rust-analyzer/issues/9574
https://github.com/rust-lang/rust-analyzer/issues/11410

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 reading the linked issues 8330, 2414, 12407, 9574, and 11410, along with the referenced discussion about lowering cargo metadata to CrateGraph. The issue names no files or tests, and rust-analyzer considers its part resolved, so done cannot be defined without identifying a remaining concrete case.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.