Skip to content

Custom targets triplets loaded from json now require "-Z json-target-spec" #21821

@BlueTheDuck

Description

@BlueTheDuck

rust-analyzer version: rust-analyzer version: 0.3.2819-standalone

rustc version: rustc 1.96.0-nightly (03749d625 2026-03-14)

editor or extension: VSCode 1.111.0, rust-lang.rust-analyzer 0.3.2819

relevant settings:
Extension settings:

{
    "rust-analyzer.cargo.target": "<path to project>/.cargo/armv5te-nintendo-ds-newlibeabi.json"
}

repository link:

code snippet to reproduce: N/A

Last January the following changes were merged into Cargo: rust-lang/cargo#16557

This pull request made it so using custom targets now required passing -Z json-target-spec when loading the definition from a JSON file.

In particular, this change affected the command cargo metadata that RA uses to gather information about the projects.

Example output right after loading a project:

Failed to read Cargo metadata with dependencies for /Cargo.toml: cargo metadata exited with an error: error: .json target specs require -Zjson-target-spec

Metadata

Metadata

Labels

A-cargocargo related issuesA-project-modelproject model and workspace related issuesC-bugCategory: bug

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions