Error for cargo run --bin {name}
should notice multiple packages have the same binary name #13312
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