Skip to content
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

Merged
merged 5 commits into from
Jul 16, 2018

Conversation

RalfJung
Copy link
Member

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

@rust-highfive
Copy link

r? @matklad

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton
Copy link
Member

Thanks! Could this be placed behind a Cargo feature though to avoid it being insta-stable?

@RalfJung
Copy link
Member Author

All right, I will look into how to do that.

@RalfJung
Copy link
Member Author

I hope I did this right =D

Copy link
Member

@alexcrichton alexcrichton left a 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?

"`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` \
Copy link
Member

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!

Copy link
Member Author

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.

@@ -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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stray whitespace change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops

@RalfJung
Copy link
Member Author

Done.

@RalfJung
Copy link
Member Author

Fixed conflicts.

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Jul 16, 2018

📌 Commit 34a5cfb has been approved by alexcrichton

bors added a commit that referenced this pull request Jul 16, 2018
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
@bors
Copy link
Contributor

bors commented Jul 16, 2018

⌛ Testing commit 34a5cfb with merge e325bff...

@bors
Copy link
Contributor

bors commented Jul 16, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing e325bff to master...

@bors bors merged commit 34a5cfb into rust-lang:master Jul 16, 2018
@bors bors mentioned this pull request Jul 16, 2018
@RalfJung RalfJung deleted the default-run branch July 17, 2018 10:54
@dhbradshaw
Copy link

Is this feature intended to go live on stable? If so, what needs to happen before it does?

@ehuss
Copy link
Contributor

ehuss commented Jun 13, 2019

@dhbradshaw I just filed a tracking issue at #7032, and nominated it for stabilization.

@ehuss ehuss added this to the 1.29.0 milestone Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

It is not possible to specify a default binary
7 participants