Cargo run silently passes arguments to target binary if user accidentally messes up +version order #10535
Labels
A-diagnostics
Area: Error and warning messages generated by Cargo itself.
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Command-run
S-needs-design
Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Problem
I recently was (for a short while) tricked into believing my program was stuck in an infinite loop. I had ran the command
It took me a while to realize that what I had written resulted in
target/debug/foo.exe +nightly --release
being ran, instead of running in release mode with the nightly compiler. I feel this is quite error prone, and that it's undesirable this happens entirely silently.Proposed Solution
I propose that we display a warning when the first argument that
cargo run
interprets as an argument for the binary to run starts with a+
. The warning can be silenced by prefixing the start of your binary argument list with--
(which you probably already should be doing anyway). Socargo run -- +nightly --release
would not result in a warning, as it indicates the user really intended this behavior.It could also simply be an error rather than a warning to start the first argument with a
+
, which would've probably been the better behavior from the start, but this could break existing scripts.Notes
No response
The text was updated successfully, but these errors were encountered: