]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc/visibility.rs
Merge commit '1411a98352ba6bee8ba3b0131c9243e5db1e6a2e' into sync_cg_clif-2021-12-31
[rust.git] / src / test / rustdoc / visibility.rs
1 // compile-flags: --document-private-items
2
3 #![feature(crate_visibility_modifier)]
4
5 #![crate_name = "foo"]
6
7 // @has 'foo/struct.FooPublic.html' '//pre' 'pub struct FooPublic'
8 pub struct FooPublic;
9 // @has 'foo/struct.FooJustCrate.html' '//pre' 'pub(crate) struct FooJustCrate'
10 crate struct FooJustCrate;
11 // @has 'foo/struct.FooPubCrate.html' '//pre' 'pub(crate) struct FooPubCrate'
12 pub(crate) struct FooPubCrate;
13 // @has 'foo/struct.FooSelf.html' '//pre' 'pub(crate) struct FooSelf'
14 pub(self) struct FooSelf;
15 // @has 'foo/struct.FooInSelf.html' '//pre' 'pub(crate) struct FooInSelf'
16 pub(in self) struct FooInSelf;
17 // @has 'foo/struct.FooPriv.html' '//pre' 'pub(crate) struct FooPriv'
18 struct FooPriv;
19
20 mod a {
21     // @has 'foo/a/struct.FooASuper.html' '//pre' 'pub(crate) struct FooASuper'
22     pub(super) struct FooASuper;
23     // @has 'foo/a/struct.FooAInSuper.html' '//pre' 'pub(crate) struct FooAInSuper'
24     pub(in super) struct FooAInSuper;
25     // @has 'foo/a/struct.FooAInA.html' '//pre' 'struct FooAInA'
26     // @!has 'foo/a/struct.FooAInA.html' '//pre' 'pub'
27     pub(in a) struct FooAInA;
28     // @has 'foo/a/struct.FooAPriv.html' '//pre' 'struct FooAPriv'
29     // @!has 'foo/a/struct.FooAPriv.html' '//pre' 'pub'
30     struct FooAPriv;
31
32     mod b {
33         // @has 'foo/a/b/struct.FooBSuper.html' '//pre' 'pub(super) struct FooBSuper'
34         pub(super) struct FooBSuper;
35         // @has 'foo/a/b/struct.FooBInSuperSuper.html' '//pre' 'pub(crate) struct FooBInSuperSuper'
36         pub(in super::super) struct FooBInSuperSuper;
37         // @has 'foo/a/b/struct.FooBInAB.html' '//pre' 'struct FooBInAB'
38         // @!has 'foo/a/b/struct.FooBInAB.html' '//pre' 'pub'
39         pub(in a::b) struct FooBInAB;
40         // @has 'foo/a/b/struct.FooBPriv.html' '//pre' 'struct FooBPriv'
41         // @!has 'foo/a/b/struct.FooBPriv.html' '//pre' 'pub'
42         struct FooBPriv;
43     }
44 }
45
46 // @has 'foo/trait.PubTrait.html' '//pre' 'pub trait PubTrait'
47 //
48 // @has 'foo/trait.PubTrait.html' '//pre' 'type Type;'
49 // @!has 'foo/trait.PubTrait.html' '//pre' 'pub type Type;'
50 //
51 // @has 'foo/trait.PubTrait.html' '//pre' 'const CONST: usize;'
52 // @!has 'foo/trait.PubTrait.html' '//pre' 'pub const CONST: usize;'
53 //
54 // @has 'foo/trait.PubTrait.html' '//pre' 'fn function();'
55 // @!has 'foo/trait.PubTrait.html' '//pre' 'pub fn function();'
56
57 pub trait PubTrait {
58     type Type;
59     const CONST: usize;
60     fn function();
61 }
62
63 // @has 'foo/struct.FooPublic.html' '//h4[@class="code-header"]' 'type Type'
64 // @!has 'foo/struct.FooPublic.html' '//h4[@class="code-header"]' 'pub type Type'
65 //
66 // @has 'foo/struct.FooPublic.html' '//h4[@class="code-header"]' 'const CONST: usize'
67 // @!has 'foo/struct.FooPublic.html' '//h4[@class="code-header"]' 'pub const CONST: usize'
68 //
69 // @has 'foo/struct.FooPublic.html' '//h4[@class="code-header"]' 'fn function()'
70 // @!has 'foo/struct.FooPublic.html' '//h4[@class="code-header"]' 'pub fn function()'
71
72 impl PubTrait for FooPublic {
73     type Type = usize;
74     const CONST: usize = 0;
75     fn function() {}
76 }