rust-lang / rust-lang/rust-analyzer

target selection for per-project rust-analyzer.toml does not seem to work

Open
#22,653 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-config C-bug
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

rust-analyzer version: rust-analyzer 1.96.0 (ac68faa 2026-05-25)

rustc version: rustc 1.96.0 (ac68faa20 2026-05-25)

editor or extension: neovim v0.12.2

relevant settings:

rust-analyzer.toml at root of project:

[cargo]
allTargets = false
target = "wasm32-unknwon-unknown"

code snippet to reproduce:

#[cfg(target_arch = "wasm32")]
fn main() {
}
  • Neovim configuration has an inline check that tells me the wasm32 target_arch is disabled. Downstream dependencies also do not have this feature enabled.

  • Does not seem like there are bugs tracking the fact that the target configuration does not appear to work in cargo.

  • Other options seem to be fine (e.g. check configurations), but anything underneath cargo seems to be ignore.

  • Would be nice to get this feature working (or make a note that it is not supported in https://rust-analyzer.github.io/book/configuration.html.

  • Working a in a project with mixed targets (wasm32 for frontend, aarch64 for backend) pretty much requires the ability to provide a per-project or per-crate rust-analyzer.toml file so code completion will work properly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the root rust-analyzer.toml containing [cargo] allTargets = false and target = "wasm32-unknwon-unknown", using the provided wasm32 cfg snippet in Neovim. Trace how per-project cargo settings are loaded and passed to target analysis, then verify that completion and cfg diagnostics recognize the selected target; if unsupported, update the configuration documentation instead.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.