]> git.proxmox.com Git - rustc.git/blob - tests/rustdoc/empty-impl-block-private-with-doc.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / rustdoc / empty-impl-block-private-with-doc.rs
1 // compile-flags: --document-private-items
2
3 #![feature(inherent_associated_types)]
4 #![allow(incomplete_features)]
5 #![crate_name = "foo"]
6
7 // @has 'foo/struct.Foo.html'
8 pub struct Foo;
9
10 // There are 3 impl blocks with public item and one that should not be displayed
11 // by default because it only contains private items (but not in this case because
12 // we used `--document-private-items`).
13 // @count - '//*[@class="impl has-srclink"]' 'impl Foo' 4
14
15 // Impl block only containing private items should not be displayed unless the
16 // `--document-private-items` flag is used.
17 /// Private
18 impl Foo {
19 const BAR: u32 = 0;
20 type FOO = i32;
21 fn hello() {}
22 }
23
24 // But if any element of the impl block is public, it should be displayed.
25 /// Not private
26 impl Foo {
27 pub const BAR: u32 = 0;
28 type FOO = i32;
29 fn hello() {}
30 }
31
32 /// Not private
33 impl Foo {
34 const BAR: u32 = 0;
35 pub type FOO = i32;
36 fn hello() {}
37 }
38
39 /// Not private
40 impl Foo {
41 const BAR: u32 = 0;
42 type FOO = i32;
43 pub fn hello() {}
44 }