Skip to content

Error for cargo run --bin {name} should notice multiple packages have the same binary name #13312

Open
@workingjubilee

Description

Problem

$ cargo run --bin strings/pgrx_embed
error: no bin target named `strings/pgrx_embed`.
Available bin targets:
    pgrx_embed
    pgrx_embed
    pgrx_embed
    pgrx_embed
    pgrx_embed
    cargo-pgrx
    pgrx_embed
    pgrx_embed
    pgrx_embed
    pgrx_embed
    pgrx_embed
    pgrx_embed
    pgrx_embed
    pgrx_embed
    pgrx_embed
    pgrx_embed
    pgrx-version-updater
    pgrx_embed
    pgrx_embed
    pgrx_embed
    pgrx_embed
    pgrx_embed
    pgrx_embed
    pgrx_embed
    pgrx_embed
    pgrx_embed
    pgrx_embed
    pgrx_embed

This is obviously bad UX, as users can even now address these individual binaries in individual packages, despite having the same name, by using e.g. cargo run -p strings --bin pgrx_embed.

Proposed Solution

While I am reconsidering the UX in this proposed changed to pgrx's tooling which would involve this diff, I would like it if cargo was able to distinguish binaries in different packages with the same name and at least emit a more useful error message.

Notes

The reason for having a binary of the same name for all these packages is that several other "tooling is bad for this" problems are being worked around by various means, and this is one of the proposed workarounds that is better than other workarounds. The current workarounds involve dlopening a Rust programmer's cdylib in order to generate SQL based on the programmer's Rust code, this one would generate a binary that knows how to emit the SQL. This could all be omitted if Rust tooling simply had a more advanced facility for emitting user-defined metadata so that we could organize it later.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-build-executionArea: anything dealing with executing the compilerA-cliArea: Command-line interface, option parsing, etc.A-rustupArea: rustup interactionC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-runS-needs-team-inputStatus: Needs input from team on whether/how to proceed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions