Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo publish error message unhelpful with publish = false #11262

Closed
wooorm opened this issue Oct 20, 2022 · 1 comment · Fixed by #11280
Closed

cargo publish error message unhelpful with publish = false #11262

wooorm opened this issue Oct 20, 2022 · 1 comment · Fixed by #11280
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself. C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-publish

Comments

@wooorm
Copy link

wooorm commented Oct 20, 2022

Problem

$ cargo publish --dry-run
error: `xxxxxxxx` cannot be published.
The registry `crates-io` is not listed in the `publish` value in Cargo.toml.

It’s a bit stupid on my part, I forgot for a second that I had publish = false in my Cargo.toml to prevent publishing, but this error message threw me off.
I can imagine that some other folks would run into this too, so I’m raising this here.

Proposed Solution

How about an error message, if publish = false, along the lines of:

error: `xxxxxxxx` cannot be published.
`publish` is set to `false` in Cargo.toml and prevents publishing.

Notes

No response

@wooorm wooorm added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Oct 20, 2022
@Rustin170506
Copy link
Member

The registry `crates-io` is not listed in the `publish` value in Cargo.toml.

I think this message makes sense but maybe needs some improvement.
Cargo said that because we can add a registry list in the publish field. You can check out this reference.
So I think the error message makes sense to say that. And I think it also makes sense to add a clear error message if we just set the publish field be false.

I am happy to help improve it if it is acceptable.

@weihanglo weihanglo added A-diagnostics Area: Error and warning messages generated by Cargo itself. Command-publish labels Oct 22, 2022
@bors bors closed this as completed in 19d37d2 Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself. C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-publish
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants