'cargo build --package ..' rebuilds after 'cargo build --all'

⚓ Rust    📅 2026-01-30    👤 surdeus    👁️ 8      

surdeus

Warning

This post was published 32 days ago. The information described in this article may have changed.

*paste title here*

I have tested this with the 'iced' crate and its examples.
Ran 'cargo build --all', also 'cargo build --all-targets' just to be sure.
After a long build, executables appeared in the 'target/debug/' directory.

Yet when I run, for example, 'cargo build --package exit', it rebuilds the package and then rewrites that 'exit' executable in the 'target/debug/' directory.
Same happens when I run a 'cargo build --all' after that - it rewrites it again.

(And I checked, sha256sum of a file from 'cargo build --all' and a file from 'cargo build --package exit' are different)

I have pre-compiled all packages specifically to 'cargo run' them instantly, yet I don't get why it doesn't work as I expect it to.

If anyone is able to provide some explanation or a link to a documentation page explaining that, I would be very grateful.

2 posts - 2 participants

Read full topic

🏷️ Rust_feed