rust-lang / rust-lang/cargo

"Advertise" workspace feature when dependencies are path-specified

Open
#7,589 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-workspaces C-feature-request S-needs-design
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

Hi,

I just realized that in projects with multiple sub-crates, adding them as members of [workspace] really helps with "ambiguous" paths in errors and warnings, as src/lib.rs:line:column gets replaced by subcrate-path/src/lib.rs:line:column, which is awesome and will massively improve my workflow.

But I really wish I had found out sooner, or even that cargo would have let me know "Hey, you have subcrate = { path = "subcrate-path" } in your dependencies, but it isn't in your workspace members, you sure you don't wan't that to get even better error messages?"

For example with CLion, it makes AwesomeConsole able to jump to the right file rather than hesitate between each src/lib.rs in the project tree, turning cargo watch -x clippy into a great "Problems" pane.

Anyhow, it's probably very low priority, but I'm sure having cargo let you know a bit more about [workspace] would help other people too :)

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 tracing Cargo's handling of workspace members and path-specified dependencies, using the issue's example as the desired case. The work is done when Cargo can clearly notify users that a path dependency is not listed as a workspace member, without disrupting valid projects.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Feature
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.