Alona Enraght-Moony 078332fdc8 rustdoc-json: Structured attributes
Implements https://www.github.com/rust-lang/rust/issues/141358.

This has 2 primary benefits:

1. For rustdoc-json consumers, they no longer need to parse strings of
   attributes, but it's there in a structured and normalized way.
2. For rustc contributors, the output of HIR pretty printing is no
   longer a versioned thing in the output. People can work on
   https://github.com/rust-lang/rust/issues/131229 without needing to
   bump `FORMAT_VERSION`.

(Over time, as the attribute refractor continues, I expect we'll add new
things to `rustdoc_json_types::Attribute`. But this can be done
separately to the rustc changes).
2025-07-15 16:52:41 +00:00

31 lines
1.1 KiB
Rust

#![no_std]
//@ count "$.index[?(@.name=='ReprCStruct')].attrs" 1
//@ is "$.index[?(@.name=='ReprCStruct')].attrs[*].repr.kind" '"c"'
//@ is "$.index[?(@.name=='ReprCStruct')].attrs[*].repr.int" null
//@ is "$.index[?(@.name=='ReprCStruct')].attrs[*].repr.packed" null
//@ is "$.index[?(@.name=='ReprCStruct')].attrs[*].repr.align" null
#[repr(C)]
pub struct ReprCStruct(pub i64);
//@ count "$.index[?(@.name=='ReprCEnum')].attrs" 1
//@ is "$.index[?(@.name=='ReprCEnum')].attrs[*].repr.kind" '"c"'
//@ is "$.index[?(@.name=='ReprCEnum')].attrs[*].repr.int" null
//@ is "$.index[?(@.name=='ReprCEnum')].attrs[*].repr.packed" null
//@ is "$.index[?(@.name=='ReprCEnum')].attrs[*].repr.align" null
#[repr(C)]
pub enum ReprCEnum {
First,
}
//@ count "$.index[?(@.name=='ReprCUnion')].attrs" 1
//@ is "$.index[?(@.name=='ReprCUnion')].attrs[*].repr.kind" '"c"'
//@ is "$.index[?(@.name=='ReprCUnion')].attrs[*].repr.int" null
//@ is "$.index[?(@.name=='ReprCUnion')].attrs[*].repr.packed" null
//@ is "$.index[?(@.name=='ReprCUnion')].attrs[*].repr.align" null
#[repr(C)]
pub union ReprCUnion {
pub left: i64,
pub right: u64,
}