Cargo check should not block cargo run #15396
Labels
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
S-triage
Status: This issue is waiting on initial triage.
Problem
I work at Zed and we are heavy users of
cargo check
, primarily through rust-analyzer.One problem that we have as a relatively large rust project is that cargo check and cargo run can take a while. We have other ideas to help with this (e.g. rust-lang/compiler-team#790), but it is our reality today.
This causes the common flow of wanting to run my changes after making them to be slower than I think they should be. This is because when I save a file, rust-analyzer starts a
cargo check
in the background, so by the time I switch to a terminal to typecargo run
, it almost always is "Blocking waiting for file lock on build directory" for a long time.As a (somewhat impatient) user, I would love if my build that I just kicked off happened immediately.
Proposed Solution
I don't know what the lock is protecting, so I can see a few different options here:
cargo run
andcargo build
could run co-operatively.cargo run
while it was running.Notes
It is possible today to avoid this locking by pointing cargo check to a different target directory when run by rust analyzer.
This works, but has the unfortunate side-effect of using more disk space (Even without this workaround, I have to run cargo clean about once a week because my target directory grows to several hundred gigabytes in that time, which causes builds to get slower still...), and seems to make the overall process slower (I guess there are some shared artifacts that cargo check and cargo build re-use from each other).
The text was updated successfully, but these errors were encountered: