Quite often I run manually cargo run
etc. only to see it wait on some existing cargo invocation, either from rust-analyzer
or cargo watch
, etc. Makes me wonder: could we have a flag to make cargo
preemptible? E.g. before starting any new crate build it would would check if any other instance is waiting for it and quit with an appropriate error code and message to yield for a more urgent invocation? The tooling that runs cargo
"in the background" could just use that flag and retry.
1 Like
I have vim-ale
, rust-analyzer
(via vim-ale
), tarpaulin
, etc. each use their own target directory. In addition to avoiding lock contention, it also avoids ping-ponging the build across different configurations (e.g., nightly
for clippy
, but stable
for building).
1 Like
This is an interesting idea.
How would one go about that? Do cargo subcommands have a --target DIR
option or something like that?
vim-ale
settings forrust-analyzer
: Support `--target-dir` with `rust-analyzer` · Issue #4557 · dense-analysis/ale · GitHubvim-ale
settings forcargo-check
: rust/cargo: add support for a custom target directory by mathstuf · Pull Request #3164 · dense-analysis/ale · GitHubcargo tarpaulin --target-dir <dir>
(mostcargo
-related tools end up forwarding this through IME; if not, file issues)
1 Like