cargo package
and cargo publish
order of registry selection differ from documentation
#14958
Labels
A-documenting-cargo-itself
Area: Cargo's documentation
C-bug
Category: bug
Command-package
Command-publish
regression-from-stable-to-stable
Regression in stable that worked in a previous stable release.
S-triage
Status: This issue is waiting on initial triage.
Problem
The Cargo book explains that for
cargo publish
/cargo package
commands, the order by which it decides which registry to publish to is as follows:--registry
CLI argpackage.publish
field inCargo.toml
if a single entryregistry.default
key in configHowever the current code checks
registry.default
prior to the manifest file. This causes error like below when bothregistry.default
andpackage.publish
are specified, and no CLI arg is supplied.Steps
cargo new demo-registry
.cargo/config.toml
[registry]
adddefault = "crates-io"
and some alternative registryCargo.toml
[package]
addpublish = ["some alternative registry"]
cargo package
andcargo publish
failsPossible Solution(s)
Not sure which is the intended behavior, can either update the code or the documentation. It would be useful to let each crate's own manifest file decide the registry in a workspace setting, so switching the order in code might be better. I tried this change to move default config check after manifest infer and it now works as documented: YutaoMa#1
Notes
No response
Version
The text was updated successfully, but these errors were encountered: