Skip to content

cargo publish --package flag is ignored when cargo isn't running in a workspace(?) #10536

Closed
@nagisa

Description

@nagisa

Problem

The stacker and psm crates are both part of the same repository, but they do not form a workspace. I tried publishing psm but cargo went on to try and publish a wrong crate (stacker).

Steps

  1. Construct a setup similar to how stacker repository is structured. 1 crate at the top level (stacker) and another as a subdirectory (psm);
  2. cd wherever-stacker-is;
  3. cargo publish -p psm.

Possible Solution(s)

Cargo perhaps should return an error, or publish the specified crate.

Notes

Interestingly, cargo test -p psm does the right thing despite there being no workspace.

Version

cargo 1.58.0 (f01b232bc 2022-01-19)
release: 1.58.0
commit-hash: f01b232bc7f4d94f0c4603930a5a96277715eb8c
commit-date: 2022-01-19
host: x86_64-unknown-linux-gnu
libgit2: 1.3.0 (sys:0.13.23 vendored)
libcurl: 7.80.0-DEV (sys:0.4.51+curl-7.80.0 vendored ssl:OpenSSL/1.1.1l)
os: NixOS 22.5.0 [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