Open kornelski opened 2 months ago
Could you provide full reproduction steps and example failure output?
cargo new crate1
cargo new crate2
Cargo.toml
at the root[workspace]
members = ["crate1", "crate2"]
default-members = ["crate1"]
and
cargo r --bin crate2
gives
error: no bin target named `crate2`
Did you mean `crate1`?
Alternatively, without default-members
, cargo r --bin
gives:
error: "--bin" takes one argument.
Available binaries:
crate1
crate2
with default-members
it considers just the members, which is technically correct:
error: "--bin" takes one argument.
Available binaries:
crate1
but it could be more helpful if it also looked at other workspace members and suggested -p
to select them with their binaries.
From a users perspective, it seems reasonable to improve. My only question is how much it would take to get the right information into the right place.
Problem
In a workspace with
default-members
set,cargo run --bin
considers only these members as expected. However, when specifying another workspace binary without-p
, the error message is unhelpful, because it doesn't hint which package needs to be selected.Steps
cargo run --bin other
where the binary is in the workspace, but not in the default workspace member.Possible Solution(s)
The error message could search other crates in the workspace and list which have a binary with the given name.
Notes
No response
Version