Skip to content

Rust-analyzer failing to work. #1427

Description

I have a Dev Container config where I use rust:1 devcontainer feature .

I open my repo using VS Code inside WSL, I get the Open in container... and click on it. The container is successfully created and at some point rust-analyzer reports an issue

Image
ERROR failed fetching data layout for ManifestPath { file: AbsPathBuf("/workspaces/libdatadog/Cargo.toml") } workspace e=unable to fetch target-data-layout via `cd "/workspaces/libdatadog" && RUSTC_BOOTSTRAP="1" RUSTUP_TOOLCHAIN="/usr/local" "/usr/local/cargo/bin/rustc" "-Z" "unstable-options" "--print" "target-spec-json"`
2025-08-01T10:38:30.932545354Z ERROR failed fetching data layout for ManifestPath { file: AbsPathBuf("/workspaces/libdatadog/Cargo.toml") } workspace e=unable to fetch target-data-layout via `cd "/workspaces/libdatadog" && RUSTC_BOOTSTRAP="1" RUSTUP_TOOLCHAIN="/usr/local" "/usr/local/cargo/bin/rustc" "-Z" "unstable-options" "--print" "target-spec-json"`
2025-08-01T10:38:31.529452361Z ERROR Flycheck failed to run the following command: CommandHandle { program: "/usr/local/cargo/bin/cargo", arguments: ["check", "--workspace", "--message-format=json-diagnostic-rendered-ansi", "--manifest-path", "/workspaces/libdatadog/Cargo.toml", "--keep-going", "--all-targets"], current_dir: Some("/workspaces/libdatadog") }, error=Cargo watcher failed, the command produced no valid metadata (exit code: ExitStatus(unix_wait_status(25856))):
warning: /workspaces/libdatadog/datadog-crashtracker-ffi/Cargo.toml: unused manifest key: target.cfg(windows).features
error: process didn't exit successfully: `rustc -vV` (exit status: 1)
--- stderr
error: 'rustc' is not installed for the custom toolchain '/usr/local'.
note: this is a custom toolchain, which cannot use `rustup component add`
help: if you built this toolchain from source, and used `rustup toolchain link`, then you may be able to build the component with `x.py`

Any idea how to make this work please ?

Activity

  1. v-Kaniska244 commented on Aug 6, 2025

    @v-Kaniska244
    Contributor

    Hello Gregory LEOCADIE (@gleocadie) ,

    Thank you for reporting this issue. Would you kindly check and let me know the toolchain/ default toolchain being used in this case?

  2. gleocadie commented on Aug 6, 2025

    @gleocadie
    Author

    👋 @Kaniska244
    I ran rustc -vV and got this

    vscode ➜ /workspaces/libdatadog $ rustc -vV
    rustc 1.88.0 (6b00bc388 2025-06-23)
    binary: rustc
    commit-hash: 6b00bc3880198600130e1cf62b8f8a93494488cc
    commit-date: 2025-06-23
    host: x86_64-unknown-linux-gnu
    release: 1.88.0
    LLVM version: 20.1.5
    
    vscode ➜ /workspaces/libdatadog $ cargo --version
    cargo 1.88.0 (873a06493 2025-05-10)
    

    Do not hesitate to ask me commands to run.
    Thanks for your help.

  3. gleocadie commented on Sep 5, 2025

    @gleocadie
    Author

    👋 @Kaniska244 any news on that ?

  4. v-Kaniska244 commented on Sep 8, 2025

    @v-Kaniska244
    Contributor

    Hello Gregory LEOCADIE (@gleocadie) ,

    Apologies for the delay from my end, I will check and update you this week.

  5. gleocadie commented on Oct 2, 2025

    @gleocadie
    Author

    👋 @Kaniska244 did you have a chance to look at it ?

  6. skevetter commented on Dec 8, 2025

    @skevetter

    What are your permissions for /usr/local/cargo/registry? I added

    "sudo chown -R vscode:vscode /usr/local/cargo/registry && sudo chmod -R u+w /usr/local/cargo/registry"
    

    To my postCreateCommand and that gives VSCode rust analyzer permissions to run. The image mcr.microsoft.com/devcontainers/rust:latest also has this same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions