rust-lang / rustc_codegen_cranelift

Cranelift based backend for rustc
Apache License 2.0
1.52k stars 94 forks source link

`Blocking waiting for file lock on build directory`: is there a way to avoid this? #1369

Closed frederikhors closed 1 year ago

frederikhors commented 1 year ago

Many times in my console I can see this line:

Blocking waiting for file lock on build directory

I think this is due to VSCode with rust-analyzer that work for the auto cargo check.

Since I'm using cargo-clif on the nightly version and VSCode with rust-analyzer are using cargo at the stable one, is there a way to avoid that Blocking... behavior?

Some setting to set?

What do you think?

I re-generate or save files and I wait for both cargo-clif and VScode to finish before starting my app again. This is very bad.

tigregalis commented 1 year ago

Not sure if this matters for cg-clif specifically, but when working with VSCode + rust-analyzer, this seems to stop that behaviour:

  "rust-analyzer.cargo.extraArgs": ["--target-dir", "target/rls/"],

This puts the RA's artifacts into a separate folder, so that your regular compilation isn't contending with RA.

frederikhors commented 1 year ago

This works amazingly well!

I'm only afraid that in future the extraArgs can be a issue, but for now it works good!

Thanks again!

frederikhors commented 1 year ago

Today I'm getting this error after a rust-analyzer update (I think):

[ERROR rust_analyzer::main_loop] FetchWorkspaceError:
rust-analyzer failed to load workspace: Failed to read Cargo metadata from Cargo.toml file C:\prj\Cargo.toml, Some(Version { major: 1, minor: 69, patch: 0 }): Failed to run `"cargo" "metadata" "--format-version" "1" "--manifest-path" "C:\\prj\\Cargo.toml" "--target-dir" "target/rls/" "--filter-platform" "x86_64-pc-windows-msvc"`: `cargo metadata` exited with an error: error: unexpected argument '--target-dir' found

Usage: cargo.exe metadata --format-version <VERSION> --manifest-path <PATH>

For more information, try '--help'.
frederikhors commented 1 year ago

https://github.com/rust-lang/rust-analyzer/issues/14719

frederikhors commented 1 year ago

Is a RA bug, sorry.