mirror of
https://github.com/rust-lang/rust.git
synced 2025-09-29 15:48:52 +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).
21 lines
684 B
Rust
21 lines
684 B
Rust
// Ensure keyword docs are present with --document-private-items
|
|
|
|
//@ compile-flags: --document-private-items
|
|
#![feature(rustdoc_internals)]
|
|
|
|
//@ !has "$.index[?(@.name=='match')]"
|
|
//@ has "$.index[?(@.name=='foo')]"
|
|
//@ is "$.index[?(@.name=='foo')].attrs[*].other" '"#[doc(keyword = \"match\")]"'
|
|
//@ is "$.index[?(@.name=='foo')].docs" '"this is a test!"'
|
|
#[doc(keyword = "match")]
|
|
/// this is a test!
|
|
pub mod foo {}
|
|
|
|
//@ !has "$.index[?(@.name=='break')]"
|
|
//@ has "$.index[?(@.name=='bar')]"
|
|
//@ is "$.index[?(@.name=='bar')].attrs[*].other" '"#[doc(keyword = \"break\")]"'
|
|
//@ is "$.index[?(@.name=='bar')].docs" '"hello"'
|
|
#[doc(keyword = "break")]
|
|
/// hello
|
|
mod bar {}
|