diff options
| author | Noratrieb <48135649+Noratrieb@users.noreply.github.com> | 2025-07-26 12:39:31 +0200 |
|---|---|---|
| committer | Noratrieb <48135649+Noratrieb@users.noreply.github.com> | 2025-09-12 20:53:28 +0200 |
| commit | f157ce994ea45e9faea9eff89c5f8b3d4ea77b6e (patch) | |
| tree | ea0f0bdfa8bb940eeb9f2dff68076bf3d7082d77 /compiler/rustc_target/src/lib.rs | |
| parent | a0bb9cc57db551289cba9fefde086e45cb82733f (diff) | |
| download | rust-f157ce994ea45e9faea9eff89c5f8b3d4ea77b6e.tar.gz rust-f157ce994ea45e9faea9eff89c5f8b3d4ea77b6e.zip | |
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.
Diffstat (limited to 'compiler/rustc_target/src/lib.rs')
| -rw-r--r-- | compiler/rustc_target/src/lib.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_target/src/lib.rs b/compiler/rustc_target/src/lib.rs index c6a23745b04..b3fe1fffcce 100644 --- a/compiler/rustc_target/src/lib.rs +++ b/compiler/rustc_target/src/lib.rs @@ -86,9 +86,11 @@ macro_rules! target_spec_enum { ) => { $( #[$attr] )* #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, PartialOrd, Ord)] + #[derive(schemars::JsonSchema)] pub enum $name { $( $( #[$variant_attr] )* + #[serde(rename = $string)] // for JSON schema generation only $variant, )* } |
