-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
rust-analyzer version: rust-analyzer 1.95.0-beta.1 (ad726b5 2026-03-05)
rustc version: rustc 1.95.0-beta.1 (ad726b506 2026-03-05)
editor or extension: vim-lsp
relevant settings: N/A
repository link (if public, optional): N/A
code snippet to reproduce: cargo new
I see this in Vim :messages:
rust-analyzer: warning: Failed to read Cargo metadata with dependencies for sysroot of `‥/Cargo.toml`: `cargo metadata` exited with an error: error: unexpected argument '--lockfile-path' found
tip: a similar argument exists: '--locked'
Usage: cargo metadata --format-version <VERSION> --manifest-path <PATH> --filter-platform <TRIPLE> --locked
For more information, try '--help'.
I did a little digging and found that this argument is controlled by:
rust-analyzer/crates/project-model/src/cargo_config_file.rs
Lines 141 to 146 in 2a8f00f
| pub(crate) enum LockfileUsage { | |
| /// Rust [1.82.0, 1.95.0). `cargo <subcmd> --lockfile-path <lockfile path>` | |
| WithFlag, | |
| /// Rust >= 1.95.0. `CARGO_RESOLVER_LOCKFILE_PATH=<lockfile path> cargo <subcmd>` | |
| WithEnvVar, | |
| } |
So in this case, we should expect it to use the env. However, in the comparison >= MINIMUM_TOOLCHAIN_VERSION_SUPPORTING_LOCKFILE_PATH_ENV (1.95.0-nightly), my prerelease "beta" is lexically less than "nightly". Rust versions are not properly semver-ordered in this regard!
A simple fix would be to just use "beta" in that MINIMUM_...PATH_ENV, then "nightly" is still >= as well.