rust-lang / rust-lang/rust-analyzer
target selection for per-project rust-analyzer.toml does not seem to work
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Rust
- Sterne
- 16.9k
- Forks
- 2.2k
- Ø Merge
- 1 T. 13 Std.
- Gemergte PRs (30 T.)
- 69
Beschreibung
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
targetconfiguration does not appear to work in cargo. -
Other options seem to be fine (e.g.
checkconfigurations), but anything underneathcargoseems 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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, das Problem mit der root rust-analyzer.toml zu reproduzieren, die [cargo] allTargets = false und target = "wasm32-unknwon-unknown" enthält, und verwende dabei das bereitgestellte wasm32 cfg-Snippet in Neovim. Verfolge, wie Cargo-Einstellungen pro Projekt geladen und an die Zielanalyse übergeben werden, und überprüfe anschließend, ob Completion und cfg-Diagnosen das ausgewählte Ziel erkennen; falls dies nicht unterstützt wird, aktualisiere stattdessen die Konfigurationsdokumentation.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- rust
- Bereich
- developer-experience, tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100