rust-lang / rust-lang/cargo

cargo install should not need to build the crate to determine there is no binary available

Open
#8,970 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

cargo-lock is a good example of this. cargo-lock only provides a binary with --features cli. If a user doesn't notice this and instead just executes cargo install cargo-lock with a clean build cache, cargo will happily build the cargo-lock library along with all its dependencies before erroring out noting that there are no binaries available.

Since the presence of a binary crate target doesn't require building the crate to discover, it would be better if cargo could give the error before spending CPU time on building the crate.

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

No files or tests are named. Start by tracing the cargo install target-discovery and error path, using cargo-lock's feature-gated CLI target as the reproducing case. Done means cargo reports the absence of an available binary before compiling the crate or its dependencies.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, cli
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.