
Description
I'm reviewing a GUI framework (Rustbox) and while I was writing my first example, I encountered this Cargo error:
error: failed to parse manifest at `/home/willem/p/rust/gui-reviews/reviews/rustbox/Cargo.toml`
Caused by:
no `package` or `project` section found.
The content of my Cargo.toml:
[dependencies]
rustbox = "*"
[[bin]]
name = "window"
path = "src/window.rs"
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 run cargo build
, the error message says:
no `package` or `project` section found.
The error message should instead say:
no `package` section found.
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: