You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would love to see this! Even better would be if I could use the same run syntax as before but cargo would build and run the appropriate executable in my packages.
To explain further, let's say I had this structure:
src/
bin/
a.rs
b.rs
bb.rs
I used to be able to run:
cargo run --bin a
cargo run --bin b
cargo run --bin bb
With workspaces, I split that into two crates like this:
a/
src/
bin/
a.rs
b/
src/
bin/
b.rs
bb.rs
It would be really nice if I could still run the same commands as above. The executable names are still the same and unique. They just belong to different crates in the same workspace now.
If the executables across crates aren't unique, then you should definitely make -p required, but otherwise it's way more ergonomic (and easier to remember) to just use the old commands.
It's the difference between cargo run -p b --bin b and cargo run --bin b.
Basically, it would be great if cargo run could run binaries from any package within a workspace. That way you could be sitting at the workspace root and run executables that you would normally have to change directories to run.
I recently left this comment on #3529 but unfortunately that issue was fixed and closed before my suggestion could be taken into account. I asked @alexcrichton and he said it would work for me to just create a new issue here.
Here's my original suggestion from that issue:
Basically, it would be great if cargo run could run binaries from any package within a workspace. That way you could be sitting at the workspace root and run executables that you would normally have to change directories to run.
@alexcrichton also mentioned that this might be neat for tests as well.
The text was updated successfully, but these errors were encountered: