mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-02 18:27:37 +00:00

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).
14 lines
718 B
Rust
14 lines
718 B
Rust
#[repr(u32)]
|
|
//@ is "$.index[?(@.name=='Foo')].attrs[*].repr.int" '"u32"'
|
|
pub enum Foo {
|
|
//@ is "$.index[?(@.name=='Tuple')].inner.variant.discriminant" null
|
|
//@ count "$.index[?(@.name=='Tuple')].inner.variant.kind.tuple[*]" 0
|
|
Tuple(),
|
|
//@ is "$.index[?(@.name=='TupleWithDiscr')].inner.variant.discriminant" '{"expr": "1", "value": "1"}'
|
|
//@ count "$.index[?(@.name=='TupleWithDiscr')].inner.variant.kind.tuple[*]" 1
|
|
TupleWithDiscr(i32) = 1,
|
|
//@ is "$.index[?(@.name=='TupleWithBinDiscr')].inner.variant.discriminant" '{"expr": "0b10", "value": "2"}'
|
|
//@ count "$.index[?(@.name=='TupleWithBinDiscr')].inner.variant.kind.tuple[*]" 2
|
|
TupleWithBinDiscr(i32, i32) = 0b10,
|
|
}
|