Skip to content

json-target-spec incorrectly documented as target-spec-json #16896

@PatchMixolydic

Description

@PatchMixolydic

Recently, custom target specs were gated behind a -Z json-target-spec flag. Trying to build with a custom target spec now prints:

error: `.json` target specs require -Zjson-target-spec to be added to the cargo invocation

There is nothing in the unstable section of the Cargo book that suggests the existence of json-target-spec, which makes it seem like this is a command line flag that exists outside of Cargo's normal unstable feature system (and therefore cannot be configured through .cargo/config.toml). However, the feature is actually documented under the name target-spec-json. -Ztarget-spec-json (or [unstable] target-spec-json = true in .cargo/config.toml) does not work, so this appears to be a typo in the documentation.

Cargo version:

cargo 1.97.0-nightly (eb94155a9 2026-04-09)
release: 1.97.0-nightly
commit-hash: eb94155a9a60943bd7b1cb04abec42f5d0de6ddc
commit-date: 2026-04-09
host: x86_64-unknown-linux-gnu
libgit2: 1.9.2 (sys:0.20.4 vendored)
libcurl: 8.19.0-DEV (sys:0.4.87+curl-8.19.0 vendored ssl:OpenSSL/3.5.4)
ssl: OpenSSL 3.5.4 30 Sep 2025
os: Arch Linux Rolling Release [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-documenting-cargo-itselfArea: Cargo's documentationA-target-specArea: target JSON spec filesC-bugCategory: bugE-easyExperience: EasyS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or review

    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