Skip to content

workspace.default-members causes cargo run --bin from-other-crate to fail with an unhelpful error #14544

@kornelski

Description

@kornelski

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

cargo 1.83.0-nightly (c1fa840a8 2024-08-29)
release: 1.83.0-nightly
commit-hash: c1fa840a85eca53818895901a53fae34247448b2
commit-date: 2024-08-29
host: aarch64-apple-darwin
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.7.1 (sys:0.4.74+curl-8.9.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Mac OS 15.0.0 [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Error and warning messages generated by Cargo itself.C-bugCategory: bugCommand-runS-needs-mentorStatus: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions