-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
implement default-run option to set default binary for cargo run #5710
Conversation
r? @matklad (rust_highfive has picked a reviewer for you, use r? to override) |
Thanks! Could this be placed behind a Cargo feature though to avoid it being insta-stable? |
All right, I will look into how to do that. |
I hope I did this right =D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks! Could this also include some documentation in src/doc
for this new nightly feature?
src/cargo/ops/cargo_run.rs
Outdated
"`cargo run` requires that a project only have one \ | ||
executable; use the `--bin` option to specify which one \ | ||
to run\navailable binaries: {}", | ||
"`cargo run` could not determine which binary to run; set `default-run` \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we may want to hold off on changing the error message here because the feature is unstable, but once stabilized seems reasonable to change!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree; I forgot to revert this after making the feature unstable.
src/cargo/ops/cargo_run.rs
Outdated
@@ -42,7 +32,8 @@ pub fn run( | |||
if bins.is_empty() { | |||
if !options.filter.is_specific() { | |||
bail!("a bin target must be available for `cargo run`") | |||
} else { | |||
} | |||
else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stray whitespace change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops
Done. |
Fixed conflicts. |
@bors: r+ |
📌 Commit 34a5cfb has been approved by |
implement default-run option to set default binary for cargo run The implementation is not pretty but as good as I could make it. The fact that all this logic in `cargo_run` is for diagnosis only and essentially just re-implements the filtering done elsewhere really threw me off. Fixes #2200
☀️ Test successful - status-appveyor, status-travis |
Is this feature intended to go live on stable? If so, what needs to happen before it does? |
@dhbradshaw I just filed a tracking issue at #7032, and nominated it for stabilization. |
The implementation is not pretty but as good as I could make it. The fact that all this logic in
cargo_run
is for diagnosis only and essentially just re-implements the filtering done elsewhere really threw me off.Fixes #2200