]> git.lizzy.rs Git - rust.git/blob - tests/rustdoc/visibility.rs
Rollup merge of #107580 - lenko-d:default_value_for_a_lifetime_generic_parameter_prod...
[rust.git] / tests / rustdoc / visibility.rs
1 // compile-flags: --document-private-items
2
3 #![crate_name = "foo"]
4
5 // @!has 'foo/index.html' '//a[@href="struct.FooPublic.html"]/..' 'FooPublic ðŸ”’'
6 // @has 'foo/struct.FooPublic.html' '//pre' 'pub struct FooPublic'
7 pub struct FooPublic;
8 // @has 'foo/index.html' '//a[@href="struct.FooJustCrate.html"]/..' 'FooJustCrate ðŸ”’'
9 // @has 'foo/struct.FooJustCrate.html' '//pre' 'pub(crate) struct FooJustCrate'
10 pub(crate) struct FooJustCrate;
11 // @has 'foo/index.html' '//a[@href="struct.FooPubCrate.html"]/..' 'FooPubCrate ðŸ”’'
12 // @has 'foo/struct.FooPubCrate.html' '//pre' 'pub(crate) struct FooPubCrate'
13 pub(crate) struct FooPubCrate;
14 // @has 'foo/index.html' '//a[@href="struct.FooSelf.html"]/..' 'FooSelf ðŸ”’'
15 // @has 'foo/struct.FooSelf.html' '//pre' 'pub(crate) struct FooSelf'
16 pub(self) struct FooSelf;
17 // @has 'foo/index.html' '//a[@href="struct.FooInSelf.html"]/..' 'FooInSelf ðŸ”’'
18 // @has 'foo/struct.FooInSelf.html' '//pre' 'pub(crate) struct FooInSelf'
19 pub(in self) struct FooInSelf;
20 // @has 'foo/index.html' '//a[@href="struct.FooPriv.html"]/..' 'FooPriv ðŸ”’'
21 // @has 'foo/struct.FooPriv.html' '//pre' 'pub(crate) struct FooPriv'
22 struct FooPriv;
23
24 // @!has 'foo/index.html' '//a[@href="pub_mod/index.html"]/..' 'pub_mod ðŸ”’'
25 pub mod pub_mod {}
26
27 // @has 'foo/index.html' '//a[@href="pub_crate_mod/index.html"]/..' 'pub_crate_mod ðŸ”’'
28 pub(crate) mod pub_crate_mod {}
29
30 // @has 'foo/index.html' '//a[@href="a/index.html"]/..' 'a ðŸ”’'
31 mod a {
32     // @has 'foo/a/index.html' '//a[@href="struct.FooASuper.html"]/..' 'FooASuper ðŸ”’'
33     // @has 'foo/a/struct.FooASuper.html' '//pre' 'pub(crate) struct FooASuper'
34     pub(super) struct FooASuper;
35     // @has 'foo/a/index.html' '//a[@href="struct.FooAInSuper.html"]/..' 'FooAInSuper ðŸ”’'
36     // @has 'foo/a/struct.FooAInSuper.html' '//pre' 'pub(crate) struct FooAInSuper'
37     pub(in super) struct FooAInSuper;
38     // @has 'foo/a/index.html' '//a[@href="struct.FooAInA.html"]/..' 'FooAInA ðŸ”’'
39     // @has 'foo/a/struct.FooAInA.html' '//pre' 'struct FooAInA'
40     // @!has 'foo/a/struct.FooAInA.html' '//pre' 'pub'
41     pub(in a) struct FooAInA;
42     // @has 'foo/a/index.html' '//a[@href="struct.FooAPriv.html"]/..' 'FooAPriv ðŸ”’'
43     // @has 'foo/a/struct.FooAPriv.html' '//pre' 'struct FooAPriv'
44     // @!has 'foo/a/struct.FooAPriv.html' '//pre' 'pub'
45     struct FooAPriv;
46
47     // @has 'foo/a/index.html' '//a[@href="b/index.html"]/..' 'b ðŸ”’'
48     mod b {
49         // @has 'foo/a/b/index.html' '//a[@href="struct.FooBSuper.html"]/..' 'FooBSuper ðŸ”’'
50         // @has 'foo/a/b/struct.FooBSuper.html' '//pre' 'pub(super) struct FooBSuper'
51         pub(super) struct FooBSuper;
52         // @has 'foo/a/b/index.html' '//a[@href="struct.FooBInSuperSuper.html"]/..' 'FooBInSuperSuper ðŸ”’'
53         // @has 'foo/a/b/struct.FooBInSuperSuper.html' '//pre' 'pub(crate) struct FooBInSuperSuper'
54         pub(in super::super) struct FooBInSuperSuper;
55         // @has 'foo/a/b/index.html' '//a[@href="struct.FooBInAB.html"]/..' 'FooBInAB ðŸ”’'
56         // @has 'foo/a/b/struct.FooBInAB.html' '//pre' 'struct FooBInAB'
57         // @!has 'foo/a/b/struct.FooBInAB.html' '//pre' 'pub'
58         pub(in a::b) struct FooBInAB;
59         // @has 'foo/a/b/index.html' '//a[@href="struct.FooBPriv.html"]/..' 'FooBPriv ðŸ”’'
60         // @has 'foo/a/b/struct.FooBPriv.html' '//pre' 'struct FooBPriv'
61         // @!has 'foo/a/b/struct.FooBPriv.html' '//pre' 'pub'
62         struct FooBPriv;
63
64         // @!has 'foo/a/b/index.html' '//a[@href="struct.FooBPub.html"]/..' 'FooBPub ðŸ”’'
65         // @has 'foo/a/b/struct.FooBPub.html' '//pre' 'pub struct FooBPub'
66         pub struct FooBPub;
67     }
68 }
69
70 // @has 'foo/trait.PubTrait.html' '//pre' 'pub trait PubTrait'
71 //
72 // @has 'foo/trait.PubTrait.html' '//pre' 'type Type;'
73 // @!has 'foo/trait.PubTrait.html' '//pre' 'pub type Type;'
74 //
75 // @has 'foo/trait.PubTrait.html' '//pre' 'const CONST: usize;'
76 // @!has 'foo/trait.PubTrait.html' '//pre' 'pub const CONST: usize;'
77 //
78 // @has 'foo/trait.PubTrait.html' '//pre' 'fn function();'
79 // @!has 'foo/trait.PubTrait.html' '//pre' 'pub fn function();'
80 //
81 // @!has 'foo/index.html' '//a[@href="trait.PubTrait.html"]/..' 'PubTrait ðŸ”’'
82
83 pub trait PubTrait {
84     type Type;
85     const CONST: usize;
86     fn function();
87 }
88
89 // @has 'foo/index.html' '//a[@href="trait.PrivTrait.html"]/..' 'PrivTrait ðŸ”’'
90 trait PrivTrait {}
91
92 // @has 'foo/struct.FooPublic.html' '//h4[@class="code-header"]' 'type Type'
93 // @!has 'foo/struct.FooPublic.html' '//h4[@class="code-header"]' 'pub type Type'
94 //
95 // @has 'foo/struct.FooPublic.html' '//h4[@class="code-header"]' 'const CONST: usize'
96 // @!has 'foo/struct.FooPublic.html' '//h4[@class="code-header"]' 'pub const CONST: usize'
97 //
98 // @has 'foo/struct.FooPublic.html' '//h4[@class="code-header"]' 'fn function()'
99 // @!has 'foo/struct.FooPublic.html' '//h4[@class="code-header"]' 'pub fn function()'
100
101 impl PubTrait for FooPublic {
102     type Type = usize;
103     const CONST: usize = 0;
104     fn function() {}
105 }