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

Error message and docs for [replace] are misleading #4212

Closed
nrc opened this issue Jun 23, 2017 · 1 comment · Fixed by #7733
Closed

Error message and docs for [replace] are misleading #4212

nrc opened this issue Jun 23, 2017 · 1 comment · Fixed by #7733
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself. A-documenting-cargo-itself Area: Cargo's documentation A-workspaces Area: workspaces

Comments

@nrc
Copy link
Member

nrc commented Jun 23, 2017

e.g., Cargo.toml:

[workspace]
members = [
    ...
]

[replace]
"rls-data" = { path = "data" }

The error here is that the package id is missing a version number (changing rls-data to rls-data:0.7.0 fixed the problem). However, the error cargo gives is "no package or project section found.".

The documentation here is confusing too: this section states "Each key in the [replace] table is a package id specification" where "package id specification" links to http://doc.crates.io/pkgid-spec.html where the version appears optional, both in the grammar and the examples.

@nrc nrc added A-documenting-cargo-itself Area: Cargo's documentation A-diagnostics Area: Error and warning messages generated by Cargo itself. A-workspaces Area: workspaces labels Jun 23, 2017
@alexcrichton
Copy link
Member

I believe this error comes from this location where the logic looks like:

  • Parse as a "real manifest"
  • If that fails, parse as a "virtual manifest"
  • If that fails, return the first error

It turns out in this situation both parsings fail, but the latter error is more relevant than the first, so we're throwing away the wrong error!

ehuss added a commit to ehuss/cargo that referenced this issue Dec 21, 2019
bors added a commit that referenced this issue Dec 22, 2019
Various doc updates

This is a collection of documentation updates that have been in my todo list for a while. Each change is in a separate commit.

The "features" chapter will probably get significant changes in the future, as it is pretty bare right now. Similarly the "workspace" chapter could probably use more examples.

Closes #3062
Closes #3817
Closes #3971
Closes #4212
Closes #4438
Closes #4756
Closes #5822
Closes #6913
Closes #7055
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. A-documenting-cargo-itself Area: Cargo's documentation A-workspaces Area: workspaces
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants