Problem
When installing with the --bin flag, unrelated binaries that are no longer in the manifest, but used to be in the same crate, will be removed
Steps
Say your crate has two binaries, bin_a, and bin_b
- Install
bin_a with cargo install --path my_crate --bin bin_a
- Remove
bin_a from the manifest. This can happen often if you are switching branches.
- Install
bin_b with cargo install --path my_crate --bin bin_b
Unexpectedly to me, bin_a will be removed from your .cargo/bin directory.
This behavior makes sense if you are installing the crate holistically, say with --bins, since the crate changed holistically (a binary was removed). However, I would argue that with the --bin flag, a user expects to only touch the specific binary they are referencing.
Possible Solution(s)
No response
Notes
No response
Version
`rustc --version --verbose`:
rustc 1.92.0 (ded5c06cf 2025-12-08)
binary: rustc
commit-hash: ded5c06cf21d2b93bffd5d884aa6e96934ee4234
commit-date: 2025-12-08
host: x86_64-unknown-linux-gnu
release: 1.92.0
LLVM version: 21.1.3
`cargo --version --verbose`
cargo 1.92.0 (344c4567c 2025-10-21)
release: 1.92.0
commit-hash: 344c4567c634a25837e3c3476aac08af84cf9203
commit-date: 2025-10-21
host: x86_64-unknown-linux-gnu
libgit2: 1.9.1 (sys:0.20.2 vendored)
libcurl: 8.15.0-DEV (sys:0.4.83+curl-8.15.0 vendored ssl:OpenSSL/3.5.4)
ssl: OpenSSL 3.5.4 30 Sep 2025
os: Arch Linux Rolling Release [64-bit]
Problem
When installing with the --bin flag, unrelated binaries that are no longer in the manifest, but used to be in the same crate, will be removed
Steps
Say your crate has two binaries,
bin_a, andbin_bbin_awithcargo install --path my_crate --bin bin_abin_afrom the manifest. This can happen often if you are switching branches.bin_bwithcargo install --path my_crate --bin bin_bUnexpectedly to me,
bin_awill be removed from your.cargo/bindirectory.This behavior makes sense if you are installing the crate holistically, say with
--bins, since the crate changed holistically (a binary was removed). However, I would argue that with the--binflag, a user expects to only touch the specific binary they are referencing.Possible Solution(s)
No response
Notes
No response
Version