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