You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My rustc source is installed on read-only filesystem (in Nix store). When I try to use rust-analyzer on out-of-tree project that uses rustc_private crates, I get the following error:
[ERROR][2023-01-06 18:37:49] .../vim/lsp/rpc.lua:734 "rpc" "rust-analyzer" "stderr" '[ERROR rust_analyzer::lsp_utils] rust-analyzer failed to load workspace: Failed to read Cargo metadata for Rust sources: Failed to run `"cargo" "metadata" "--format-version" "1" "--all-features" "--manifest-path" "/nix/store/686jpzdz5zxlfhy682gc2qyf98ri413l-rust-minimal-1.68.0-nightly-2022-12-13/lib/rustlib/rustc-src/rust/compiler/rustc/Cargo.toml" "--filter-platform" "x86_64-unknown-linux-gnu"`: `cargo metadata` exited with an error: Updating crates.io index\nerror: failed to write /nix/store/686jpzdz5zxlfhy682gc2qyf98ri413l-rust-minimal-1.68.0-nightly-2022-12-13/lib/rustlib/rustc-src/rust/compiler/rustc/Cargo.lock\n\nCaused by:\n failed to open: /nix/store/686jpzdz5zxlfhy682gc2qyf98ri413l-rust-minimal-1.68.0-nightly-2022-12-13/lib/rustlib/rustc-src/rust/compiler/rustc/Cargo.lock\n\nCaused by:\n Read-only file system (os error 30)\n\n'
I think that rust-analyzer shouldn’t try to write anything inside of rustc-src directory, since it can be installed globally (e.g. with Nix or other third-party package manager).
rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P)
rust-analyzer 1.68.0-nightly (37d7de3 2022-12-12)
rustc version: (eg. output of rustc -V)
rustc 1.68.0-nightly (37d7de337 2022-12-12)
relevant settings: (eg. client settings, or environment variables like CARGO, RUSTUP_HOME or CARGO_HOME)
rust-analyzer.rustc-source is set to "discover"
In Cargo.toml, package.metadata.rust-analyzer.rustc_private is set to true
The text was updated successfully, but these errors were encountered:
Rust-analyzer runs cargo metadata in the rustc source directory. This updates the Cargo.lock file if it is outdated and due to the way the rustc-src component is created, it is indeed outdated as it mentions the standard library crates too, which only exist in the rust-src component, not the rustc-src component. Cargo doesn't have an option to not update Cargo.lock, other than --locked, which instead errors if Cargo.lock is not up to date.
My rustc source is installed on read-only filesystem (in Nix store). When I try to use rust-analyzer on out-of-tree project that uses
rustc_private
crates, I get the following error:I think that
rust-analyzer
shouldn’t try to write anything inside ofrustc-src
directory, since it can be installed globally (e.g. with Nix or other third-party package manager).rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P)
rustc version: (eg. output of
rustc -V
)relevant settings: (eg. client settings, or environment variables like
CARGO
,RUSTUP_HOME
orCARGO_HOME
)rust-analyzer.rustc-source
is set to"discover"
Cargo.toml
,package.metadata.rust-analyzer.rustc_private
is set totrue
The text was updated successfully, but these errors were encountered: