]> git.lizzy.rs Git - rust.git/blob - tests/rustdoc/hidden-private.rs
Rollup merge of #107769 - compiler-errors:pointer-like, r=eholk
[rust.git] / tests / rustdoc / hidden-private.rs
1 // This is a regression test for <https://github.com/rust-lang/rust/issues/106373>.
2 // It ensures that the items in the `doc(hidden)` const block don't show up in the
3 // generated docs.
4
5 // compile-flags: --document-private-items
6
7 #![crate_name = "foo"]
8
9 // @has 'foo/index.html'
10 // @count - '//*[@class="item-table"]//a[@class="struct"]' 2
11 // @count - '//*[@class="item-table"]//a[@class="trait"]' 1
12 // @count - '//*[@class="item-table"]//a[@class="macro"]' 0
13 #[doc(hidden)]
14 const _: () = {
15     macro_rules! stry {
16         () => {};
17     }
18
19     struct ShouldBeHidden;
20
21     // @has 'foo/struct.Foo.html'
22     // @!has - '//*[@class="code-header"]' 'impl Bar for Foo'
23     #[doc(hidden)]
24     impl Bar for Foo {
25         fn bar(&self) {
26             struct SHouldAlsoBeHidden;
27         }
28     }
29
30     // @has 'foo/struct.Private.html'
31     // @has - '//*[@id="impl-Bar-for-Private"]/*[@class="code-header"]' 'impl Bar for Private'
32     // @has - '//*[@id="method.bar"]/*[@class="code-header"]' 'fn bar(&self)'
33     impl Bar for Private {
34         fn bar(&self) {}
35     }
36
37     // @has - '//*[@id="impl-Private"]/*[@class="code-header"]' 'impl Private'
38     // @has - '//*[@id="method.tralala"]/*[@class="code-header"]' 'fn tralala()'
39     impl Private {
40         fn tralala() {}
41     }
42 };
43
44
45 struct Private;
46 pub struct Foo;
47
48 pub trait Bar {
49     fn bar(&self);
50 }