Skip to content

Rust 1.95.0-beta tries the wrong LockfileUsage #21761

@cuviper

Description

@cuviper

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:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cargocargo related issuesBroken WindowBugs / technical debt to be addressed immediatelyC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions