-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 should only recommend package
, not project
#3388
Comments
The error isn't erroneous but probably shouldn't suggest deprecated things. |
Ah yeah we at one point had a vision for distinguishing between these two sections, but at this point they're just synonymous (the distinction was never implemented). We should probably change the error message to just mention the one generated by |
package
, not project
Fix error message when Cargo.toml misses a [package] section Fixes #3388.
Reduce references to `[project]` within cargo There was an issue (#11129) with `[project]` being put in the docs but nothing else stating what `[project]` is. This was an oversight by me when writing the docs as `[project]` is still supported in cargo. [Back in 2014](86b2a2a) `[project]` was [renamed to `[package]`](#3388 (comment)), since then it has kinda sat as something that exists and is supported but not really. I brought this up in a [zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/removal.20of.20.60.5Bproject.5D.60), and it was suggested that we could show a warning when `[project]` is used in a manifest of a _top-level_ crate. To go slightly further than this I tried to change as many references from `[project]` to `[package]` as possible. This should hopefully help with confusion between `[project]` and `[package]` in the future. This PR also includes a cherry-picked commit from #11131 as it was having issues with bors and fits well with the changes that are being made in this PR. This should ideally be reviewed commit by commit
I'm reviewing a GUI framework (Rustbox) and while I was writing my first example, I encountered this Cargo error:
The content of my Cargo.toml:
Now, I am aware that I am missing the
[package]
section, I've since added it, but I'm puzzled by the error message I got. What is a[project]
section? I looked at the documentation on the Cargo.toml Manifest Format here but it did not contain a section on[project]
.I found references to the [project] section in these three files:
https://github.com/rust-lang/cargo/blob/master/tests/metadata.rs
https://github.com/rust-lang/cargo/blob/master/tests/build.rs
https://github.com/rust-lang/cargo/blob/master/src/cargo/util/toml.rs
Does this section still exist but missing in the docs, did I read the docs badly, or does this section no longer exist and is the error erroneous?
Instructions to fix added by @carols10cents:
This is still an issue as of cargo 0.23.0-nightly (8118b02 2017-09-14). If your Cargo.toml doesn't have a
[package]
section and you runcargo build
, the error message says:The error message should instead say:
The error message comes from this spot:
cargo/src/cargo/util/toml/mod.rs
Line 516 in 7da5c84
And then these two tests will need to be updated:
cargo/tests/build.rs
Line 95 in 7da5c84
cargo/tests/metadata.rs
Line 550 in 7da5c84
The text was updated successfully, but these errors were encountered: