Skip to content

Document rust-analyzer cargo workaround for 2021 edition #1217

Closed
@aDotInTheVoid

Description

@aDotInTheVoid

To get RA to work (currently) you need to run rustup override set beta, so the cargo RA invokes considers rust 2021 stable.

Otherwise you get this error:

rust-analyzer failed to load workspace: Failed to read Cargo metadata from Cargo.toml file /home/nixon/upstreams/rust/rust/Cargo.toml, cargo 1.55.0 (32da73ab1 2021-08-23): Failed to run `cargo metadata --manifest-path /home/nixon/upstreams/rust/rust/Cargo.toml`: `cargo metadata` exited with an error: error: failed to load manifest for workspace member `/home/nixon/upstreams/rust/rust/src/bootstrap` Caused by: failed to parse manifest at `/home/nixon/upstreams/rust/rust/src/bootstrap/Cargo.toml` Caused by: feature `edition2021` is required The package requires the Cargo feature called `edition2021`, but that feature is not stabilized in this version of Cargo (1.55.0 (32da73ab1 2021-08-23)). Consider trying a newer version of Cargo (this may require the nightly release). See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#edition-2021 for more information about the status of this feature.

Either this should be documented or .vscode/settings.json should point RA to the cargo downloaded by x.py.

I think the latter is more "elegant", but I dont know if its possible with RA.

Also, previously RA was fine with stable cargo, as AUIU it just needs it to run cargo metadata, as cargo check is already overridden, so once 1.56 is stable, this may no longer be needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-mediumDifficulty: might require some prior knowledge or code reading

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions