Skip to content

Commit f1eef38

Browse files
authored
Rollup merge of rust-lang#125503 - aDotInTheVoid:rdj-keyword-attr, r=GuillaumeGomez
rustdoc-json: Add test for keywords with `--document-private-items` Turns out this does work as-expected. I was worried that the rustdoc's clean would produce a `ItemKind::KeywordItem` for the module, and loose the module itself. But turns out we get this right. Prompted by [this discussion on zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/Where.20to.20find.20keyword.20entries.20in.20JSON.20rustdoc) r? `@GuillaumeGomez`
2 parents 104e1a4 + 3ee8498 commit f1eef38

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Diff for: tests/rustdoc-json/keyword_private.rs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Ensure keyword docs are present with --document-private-items
2+
3+
//@ compile-flags: --document-private-items
4+
#![feature(rustdoc_internals)]
5+
6+
// @!has "$.index[*][?(@.name=='match')]"
7+
// @has "$.index[*][?(@.name=='foo')]"
8+
// @is "$.index[*][?(@.name=='foo')].attrs" '["#[doc(keyword = \"match\")]"]'
9+
// @is "$.index[*][?(@.name=='foo')].docs" '"this is a test!"'
10+
#[doc(keyword = "match")]
11+
/// this is a test!
12+
pub mod foo {}
13+
14+
// @!has "$.index[*][?(@.name=='hello')]"
15+
// @has "$.index[*][?(@.name=='bar')]"
16+
// @is "$.index[*][?(@.name=='bar')].attrs" '["#[doc(keyword = \"hello\")]"]'
17+
// @is "$.index[*][?(@.name=='bar')].docs" '"hello"'
18+
#[doc(keyword = "hello")]
19+
/// hello
20+
mod bar {}

0 commit comments

Comments
 (0)