]> git.proxmox.com Git - rustc.git/blame - src/test/rustdoc/visibility.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / rustdoc / visibility.rs
CommitLineData
fc512014
XL
1// compile-flags: --document-private-items
2
fc512014
XL
3#![crate_name = "foo"]
4
5e7ed085 5// @!has 'foo/index.html' '//a[@href="struct.FooPublic.html"]/..' 'FooPublic 🔒'
fc512014
XL
6// @has 'foo/struct.FooPublic.html' '//pre' 'pub struct FooPublic'
7pub struct FooPublic;
5e7ed085 8// @has 'foo/index.html' '//a[@href="struct.FooJustCrate.html"]/..' 'FooJustCrate 🔒'
fc512014 9// @has 'foo/struct.FooJustCrate.html' '//pre' 'pub(crate) struct FooJustCrate'
923072b8 10pub(crate) struct FooJustCrate;
5e7ed085 11// @has 'foo/index.html' '//a[@href="struct.FooPubCrate.html"]/..' 'FooPubCrate 🔒'
fc512014
XL
12// @has 'foo/struct.FooPubCrate.html' '//pre' 'pub(crate) struct FooPubCrate'
13pub(crate) struct FooPubCrate;
5e7ed085 14// @has 'foo/index.html' '//a[@href="struct.FooSelf.html"]/..' 'FooSelf 🔒'
fc512014
XL
15// @has 'foo/struct.FooSelf.html' '//pre' 'pub(crate) struct FooSelf'
16pub(self) struct FooSelf;
5e7ed085 17// @has 'foo/index.html' '//a[@href="struct.FooInSelf.html"]/..' 'FooInSelf 🔒'
fc512014
XL
18// @has 'foo/struct.FooInSelf.html' '//pre' 'pub(crate) struct FooInSelf'
19pub(in self) struct FooInSelf;
5e7ed085 20// @has 'foo/index.html' '//a[@href="struct.FooPriv.html"]/..' 'FooPriv 🔒'
fc512014
XL
21// @has 'foo/struct.FooPriv.html' '//pre' 'pub(crate) struct FooPriv'
22struct FooPriv;
23
5e7ed085
FG
24// @!has 'foo/index.html' '//a[@href="pub_mod/index.html"]/..' 'pub_mod 🔒'
25pub mod pub_mod {}
26
27// @has 'foo/index.html' '//a[@href="pub_crate_mod/index.html"]/..' 'pub_crate_mod 🔒'
28pub(crate) mod pub_crate_mod {}
29
30// @has 'foo/index.html' '//a[@href="a/index.html"]/..' 'a 🔒'
fc512014 31mod a {
5e7ed085 32 // @has 'foo/a/index.html' '//a[@href="struct.FooASuper.html"]/..' 'FooASuper 🔒'
fc512014
XL
33 // @has 'foo/a/struct.FooASuper.html' '//pre' 'pub(crate) struct FooASuper'
34 pub(super) struct FooASuper;
5e7ed085 35 // @has 'foo/a/index.html' '//a[@href="struct.FooAInSuper.html"]/..' 'FooAInSuper 🔒'
fc512014
XL
36 // @has 'foo/a/struct.FooAInSuper.html' '//pre' 'pub(crate) struct FooAInSuper'
37 pub(in super) struct FooAInSuper;
5e7ed085 38 // @has 'foo/a/index.html' '//a[@href="struct.FooAInA.html"]/..' 'FooAInA 🔒'
fc512014
XL
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;
5e7ed085 42 // @has 'foo/a/index.html' '//a[@href="struct.FooAPriv.html"]/..' 'FooAPriv 🔒'
fc512014
XL
43 // @has 'foo/a/struct.FooAPriv.html' '//pre' 'struct FooAPriv'
44 // @!has 'foo/a/struct.FooAPriv.html' '//pre' 'pub'
45 struct FooAPriv;
46
5e7ed085 47 // @has 'foo/a/index.html' '//a[@href="b/index.html"]/..' 'b 🔒'
fc512014 48 mod b {
5e7ed085 49 // @has 'foo/a/b/index.html' '//a[@href="struct.FooBSuper.html"]/..' 'FooBSuper 🔒'
fc512014
XL
50 // @has 'foo/a/b/struct.FooBSuper.html' '//pre' 'pub(super) struct FooBSuper'
51 pub(super) struct FooBSuper;
5e7ed085 52 // @has 'foo/a/b/index.html' '//a[@href="struct.FooBInSuperSuper.html"]/..' 'FooBInSuperSuper 🔒'
fc512014
XL
53 // @has 'foo/a/b/struct.FooBInSuperSuper.html' '//pre' 'pub(crate) struct FooBInSuperSuper'
54 pub(in super::super) struct FooBInSuperSuper;
5e7ed085 55 // @has 'foo/a/b/index.html' '//a[@href="struct.FooBInAB.html"]/..' 'FooBInAB 🔒'
fc512014
XL
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;
5e7ed085 59 // @has 'foo/a/b/index.html' '//a[@href="struct.FooBPriv.html"]/..' 'FooBPriv 🔒'
fc512014
XL
60 // @has 'foo/a/b/struct.FooBPriv.html' '//pre' 'struct FooBPriv'
61 // @!has 'foo/a/b/struct.FooBPriv.html' '//pre' 'pub'
62 struct FooBPriv;
5e7ed085
FG
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;
fc512014
XL
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();'
5e7ed085
FG
80//
81// @!has 'foo/index.html' '//a[@href="trait.PubTrait.html"]/..' 'PubTrait 🔒'
fc512014
XL
82
83pub trait PubTrait {
84 type Type;
85 const CONST: usize;
86 fn function();
87}
88
5e7ed085
FG
89// @has 'foo/index.html' '//a[@href="trait.PrivTrait.html"]/..' 'PrivTrait 🔒'
90trait PrivTrait {}
91
17df50a5
XL
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'
fc512014 94//
17df50a5
XL
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'
fc512014 97//
17df50a5
XL
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()'
fc512014
XL
100
101impl PubTrait for FooPublic {
102 type Type = usize;
103 const CONST: usize = 0;
104 fn function() {}
105}