devcontainers / devcontainers/features
Rust-analyzer failing to work.
- Dominant language
- Shell
- Stars
- 1.5k
- Forks
- 621
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 4
Description
I have a Dev Container [config](https://github.com/DataDog/libdatadog/blob/main/.devcontainer/devcontainer.json) where I use `rust:1` [devcontainer feature](https://github.com/DataDog/libdatadog/blob/main/.devcontainer/devcontainer.json#L22C9-L22C48) .
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
```
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 ?
Contributor guide
Assessment
This issue has not been assessed yet.