mirror of
https://github.com/rust-lang/rust.git
synced 2025-09-28 05:34:45 +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).
20 lines
397 B
Rust
20 lines
397 B
Rust
#![no_std]
|
|
|
|
//@ is "$.index[?(@.name=='MyEnum')].attrs" '["non_exhaustive"]'
|
|
#[non_exhaustive]
|
|
pub enum MyEnum {
|
|
First,
|
|
}
|
|
|
|
pub enum NonExhaustiveVariant {
|
|
//@ is "$.index[?(@.name=='Variant')].attrs" '["non_exhaustive"]'
|
|
#[non_exhaustive]
|
|
Variant(i64),
|
|
}
|
|
|
|
//@ is "$.index[?(@.name=='MyStruct')].attrs" '["non_exhaustive"]'
|
|
#[non_exhaustive]
|
|
pub struct MyStruct {
|
|
pub x: i64,
|
|
}
|