rust-lang / rust-lang/rust-analyzer

Rust-analyzer doesn't recognize JSON target files

Open
#16,543 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P)

rust-analyzer version: 0.3.1839-standalone

rustc version: (eg. output of rustc -V)

rustc 1.78.0-nightly (256b6fb19 2024-02-06)

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTC, RUSTUP_HOME or CARGO_HOME)

Nothing out of the ordinary.


I have several targets defined by .json files. Normally RA can handle them if they are targeting the same architecture as the host, but cannot if I'm specifying them via .cargo/config.toml's build.target = [...] property. It states it can't find the target name to acquire a toolchain (name of the file sans .json) which... of course it can't. Cargo can handle them correctly because it's using the llvm-target property under the hood.

The net effect of which is that editing cross-platform stuff with custom target JSONs is not possible with RA.

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 custom target JSON files referenced through .cargo/config.toml's build.target setting, comparing the host-target case with the cross-platform case. Trace how rust-analyzer acquires a toolchain for the target name; done means JSON targets are recognized and cross-platform editing works without the target-name lookup failure.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.