Add --print target-spec-json-schema by Noratrieb · Pull Request #144498 · rust-lang/rust
added
S-waiting-on-author
labels
Jul 26, 2025labels
Jul 26, 2025
Noratrieb
marked this pull request as ready for review
rustbot
added
S-waiting-on-review
and removed S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.labels
Jul 27, 2025
jieyouxu
added
S-waiting-on-MCP
and removed S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.labels
Jul 29, 2025With this macro we only need to enumerate every variant once. This saves a lot of duplication already between the definition, the `FromStr` impl and the `ToJson` impl. It also enables us to do further things with it like JSON schema generation.
rustbot
added
S-waiting-on-review
and removed S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.labels
Sep 12, 2025
bors
added
S-waiting-on-bors
and removed S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.labels
Sep 13, 2025bors added a commit that referenced this pull request
Sep 13, 2025Rollup of 5 pull requests Successful merges: - #144498 (Add --print target-spec-json-schema) - #145471 (Stabilize BTree{Map,Set}::extract_if) - #145896 (Rehome 30 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [#3 of Batch #2]) - #146450 (bootstrap: rustdoc-js tests can now be filtered by js files) - #146456 (Fix panic and incorrectly suggested examples in `format_args` macro.) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer added a commit that referenced this pull request
Sep 13, 2025Rollup merge of #144498 - Noratrieb:rustc-json-schema, r=jieyouxu,davidtwco Add --print target-spec-json-schema This schema is helpful for people writing custom target spec JSON. It can provide autocomplete in the editor, and also serves as documentation when there are documentation comments on the structs, as `schemars` will put them in the schema. I was motivated to do this because I saw someone write their own version of this schema by hand, so demand for this clearly exists. It's not a lot of effort to implement, so I thought it would make sense. MCP: rust-lang/compiler-team#905 I think it would also be useful to put this in the sysroot in `etc` so people can link it directly in their editors. I would have loved to add a test that validates the JSON schema against the spec JSON of every builtin target, but I don't want to do it as the JSON schema validation crates have incredible amounts of dependencies because JSON schema supports a ton of random features. I don't want to add that, even as a dev dependency.
ehuss
mentioned this pull request
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters