Skip to content

cargo -h is misleading when building multiple bin with a src/main.rs #3115

@Cobrand

Description

@Cobrand

if you have

src/
    main.rs
    bin/
        other_bin.rs
        other_bin2.rs

cargo run will say that it requires that a project have one executable, "use the --bin option to specify which one to run".

However cargo -h clearly says that cargo run "Build and execute src/main.rs"

So why should I have to specify --bin if I want to build src/main.rs ? Is this the intended behaviour ? If it isn't, well it's probably a bug. If it is, maybe some rewording in cargo -h will help, and maybe add an option in Cargo.toml along "[[bin]]" which would allow you to say which bin is built by default (like a field default = true). I think that no matter how many binaries you have, if you have a src/main.rs, it should build that by default.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions