-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cargo -h is misleading when building multiple bin with a src/main.rs #3115
Comments
Ah sounds like it should the small docs there should be updated! |
I'm fine with this being a doc problem, but should cargo behave that way ? I don't think it makes much sense that someone has to type I personally think it makes more sense to run by default |
To Cargo at least any bin target is the same as the other, whether it's |
Is this because of technical reasons (like, it was the easiest way to implement this) or because someone decided that it would explicitly be like that because of some X reason ? If the latter, I think I will submit a PR at some point in the future allowing to compile src/main.rs when running only |
This basically just fell out of the initial implementation. It wasn't really decided either for or against. @rust-lang/tools, thoughts about this issue? |
Since there are no objections, I take it that any PR about this issue won't be closed right away ? |
I might recommend holding off on sending a PR just yet until we get some more opinions. I'd personally at least prefer to treat all binaries as equal as opposed to making some special over others. |
if you have
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 thatcargo 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.The text was updated successfully, but these errors were encountered: