Easy way to access the built binary

That seems quite powerful in fact. I had forgotten Cargo aliases exist... :smiley:

For posterity, the following alias in a project's .cargo/config.toml[1] file gives the same feature as the Bash alias in my comment above, with the addition that it can be easily version-controlled:

[alias]
which = ["run", "--quiet", "--config", "target.'cfg(true)'.runner='echo'"]

I think the major difference between ls and echo boils down to accessing the path even if – somehow – the binary disappears before its location is given to the command.


  1. Configuration - The Cargo Book â†Šī¸Ž

4 Likes