Skip to content

Error message when creating a bin project suggests [bin] section in Cargo.toml instead of [[bin]] #9876

@geauxvirtual

Description

@geauxvirtual

Problem

When attempting to create project with an invalid name, such as with a leading number instead of a letter, cargo outputs an error with a suggestion to set the name for the binary via a [bin] section being added to Cargo.toml. However, adding a [bin] section to Cargo.toml causes another error to be thrown when trying to compile the project invalid type: map, expected a sequence for key "bin" as the key should be [[bin]] in Cargo.toml.

Steps

  1. Run cargo init --bin 1foo
  2. Error message suggests adding [bin] section.
  3. Add [bin] section and try to compile project results in another error message

Possible Solution(s)

Help message should provide the proper key to be added to Cargo.toml.
[[bin]]

Notes

Output of cargo version: cargo 1.51.0 (43b129a 2021-03-16)

Checking the project, this is still the case in current master branch.

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions