-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P)
0.3.1463-standalone and 0.4.1465-standalone
rustc version: (eg. output of rustc -V
)
rustc 1.70.0-nightly (2eaeb1eee 2023-04-05)
relevant settings: (eg. client settings, or environment variables like CARGO
, RUSTC
, RUSTUP_HOME
or CARGO_HOME
)
I would like to pass some extra arguments to cargo.
According to the rust-analyser documentation this should be possible via rust-analyzer.cargo.extraArgs
which says Extra arguments that are passed to every cargo invocation.
settings.json:
{
"[rust]": {
"editor.defaultFormatter": "rust-lang.rust-analyzer",
"editor.formatOnSave": true
},
"rust-analyzer.cargo.extraArgs": ["-Z", "bindeps"],
}
The flag is used to get this working:
[dependencies]
wasi_snapshot_preview1 = { git = "https://github.com/bytecodealliance/preview2-prototyping", rev = "083879c", target = "wasm32-unknown-unknown", artifact = "cdylib" }
Unfortunately rust-analyser shows me an error. From this error message it also appears that -Z bindeps
is not passed with.
[ERROR rust_analyzer::main_loop] FetchWorkspaceError:
rust-analyzer failed to load workspace: Failed to read Cargo metadata from Cargo.toml file /home/giom/repos/jfc/noops/Cargo.toml, Some(Version { major: 1, minor: 70, patch: 0, pre: Prerelease("nightly") }): Failed to run `cd "/home/giom/repos/jfc/noops" && "cargo" "metadata" "--format-version" "1" "--manifest-path" "/home/giom/repos/jfc/noops/Cargo.toml" "--filter-platform" "x86_64-unknown-linux-gnu"`: `cargo metadata` exited with an error: error: failed to load manifest for workspace member `/home/giom/repos/jfc/noops/noops-server`
Caused by:
failed to parse manifest at `/home/giom/repos/jfc/noops/noops-server/Cargo.toml`
Caused by:
`artifact = …` requires `-Z bindeps` (wasi_snapshot_preview1)
If I use the command from the error message and append -Z bindeps
the metadata is created successfully.