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
- Run
cargo init --bin 1foo
- Error message suggests adding
[bin] section.
- 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.