Skip to content

Error message should only recommend package, not project #3388

Closed
@ghost

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:

CargoError::from("no `package` or `project` section found.")

And then these two tests will need to be updated:

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Error and warning messages generated by Cargo itself.C-bugCategory: bugE-easyExperience: EasyT-cargoTeam: Cargo

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions