Skip to content

cargo install --git builds workspace.default-members when it should not #11058

Closed
@tedinski

Description

@tedinski

Problem

  • This affects --path as well.
  • It does not affect e.g. crates.io because the Cargo.toml there have workspace stripped from them.

When running a command like:

cargo install --locked --git https://github.com/model-checking/kani  kani-verifier

The "normal" behavior is to check out that repo, and only build the specified kani-verifier package from the workspace. Once we've added a workspace.default-members to Cargo.toml, however, cargo now seems to build those packages as well. (For Kani specifically, this fails, as other workspace members like kani-compiler should only be built against a specific Rust nightly...)

We did not expect cargo install behavior to change by changing workspace default members, and I believe this is a bug.

Steps

  1. Create a cargo workspace with multiple packages and workspace.default-members
  2. cargo install --path or --git one package from that workspace.
  3. Observe that all default-members get built as well.

Possible Solution(s)

No response

Notes

Suggested tags:

  • Command-install
  • A-workspaces

Version

cargo 1.65.0-nightly (4ed54cecc 2022-08-27)
release: 1.65.0-nightly
commit-hash: 4ed54cecce3ce9ab6ff058781f4c8a500ee6b8b5
commit-date: 2022-08-27
host: x86_64-unknown-linux-gnu
libgit2: 1.5.0 (sys:0.15.0 vendored)
libcurl: 7.83.1-DEV (sys:0.4.55+curl-7.83.1 vendored ssl:OpenSSL/1.1.1q)
os: Ubuntu 20.04 (focal) [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions