]>
Commit | Line | Data |
---|---|---|
ea8adc8c XL |
1 | /* This file incorporates work covered by the following copyright and |
2 | * permission notice: | |
3 | * Copyright 2013 The Rust Project Developers. See the COPYRIGHT | |
4 | * file at the top-level directory of this distribution and at | |
5 | * http://rust-lang.org/COPYRIGHT. | |
6 | * | |
7 | * Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
8 | * http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
9 | * <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
10 | * option. This file may not be copied, modified, or distributed | |
11 | * except according to those terms. | |
12 | */ | |
13 | ||
abe05a73 XL |
14 | |
15 | ||
ea8adc8c XL |
16 | #![warn(missing_docs_in_private_items)] |
17 | ||
18 | // When denying at the crate level, be sure to not get random warnings from the | |
19 | // injected intrinsics by the compiler. | |
20 | #![allow(dead_code)] | |
21 | #![feature(associated_type_defaults)] | |
22 | ||
23 | //! Some garbage docs for the crate here | |
24 | #![doc="More garbage"] | |
25 | ||
26 | type Typedef = String; | |
27 | pub type PubTypedef = String; | |
28 | ||
29 | struct Foo { | |
30 | a: isize, | |
31 | b: isize, | |
32 | } | |
33 | ||
34 | pub struct PubFoo { | |
35 | pub a: isize, | |
36 | b: isize, | |
37 | } | |
38 | ||
39 | #[allow(missing_docs_in_private_items)] | |
40 | pub struct PubFoo2 { | |
41 | pub a: isize, | |
42 | pub c: isize, | |
43 | } | |
44 | ||
45 | mod module_no_dox {} | |
46 | pub mod pub_module_no_dox {} | |
47 | ||
48 | /// dox | |
49 | pub fn foo() {} | |
50 | pub fn foo2() {} | |
51 | fn foo3() {} | |
52 | #[allow(missing_docs_in_private_items)] pub fn foo4() {} | |
53 | ||
54 | /// dox | |
55 | pub trait A { | |
56 | /// dox | |
57 | fn foo(&self); | |
58 | /// dox | |
59 | fn foo_with_impl(&self) {} | |
60 | } | |
61 | ||
62 | #[allow(missing_docs_in_private_items)] | |
63 | trait B { | |
64 | fn foo(&self); | |
65 | fn foo_with_impl(&self) {} | |
66 | } | |
67 | ||
68 | pub trait C { | |
69 | fn foo(&self); | |
70 | fn foo_with_impl(&self) {} | |
71 | } | |
72 | ||
73 | #[allow(missing_docs_in_private_items)] | |
74 | pub trait D { | |
75 | fn dummy(&self) { } | |
76 | } | |
77 | ||
78 | /// dox | |
79 | pub trait E { | |
80 | type AssociatedType; | |
81 | type AssociatedTypeDef = Self; | |
82 | ||
83 | /// dox | |
84 | type DocumentedType; | |
85 | /// dox | |
86 | type DocumentedTypeDef = Self; | |
87 | /// dox | |
88 | fn dummy(&self) {} | |
89 | } | |
90 | ||
91 | impl Foo { | |
92 | pub fn foo() {} | |
93 | fn bar() {} | |
94 | } | |
95 | ||
96 | impl PubFoo { | |
97 | pub fn foo() {} | |
98 | /// dox | |
99 | pub fn foo1() {} | |
100 | fn foo2() {} | |
101 | #[allow(missing_docs_in_private_items)] pub fn foo3() {} | |
102 | } | |
103 | ||
104 | #[allow(missing_docs_in_private_items)] | |
105 | trait F { | |
106 | fn a(); | |
107 | fn b(&self); | |
108 | } | |
109 | ||
110 | // should need to redefine documentation for implementations of traits | |
111 | impl F for Foo { | |
112 | fn a() {} | |
113 | fn b(&self) {} | |
114 | } | |
115 | ||
116 | // It sure is nice if doc(hidden) implies allow(missing_docs), and that it | |
117 | // applies recursively | |
118 | #[doc(hidden)] | |
119 | mod a { | |
120 | pub fn baz() {} | |
121 | pub mod b { | |
122 | pub fn baz() {} | |
123 | } | |
124 | } | |
125 | ||
126 | enum Baz { | |
127 | BazA { | |
128 | a: isize, | |
129 | b: isize | |
130 | }, | |
131 | BarB | |
132 | } | |
133 | ||
134 | pub enum PubBaz { | |
135 | PubBazA { | |
136 | a: isize, | |
137 | }, | |
138 | } | |
139 | ||
140 | /// dox | |
141 | pub enum PubBaz2 { | |
142 | /// dox | |
143 | PubBaz2A { | |
144 | /// dox | |
145 | a: isize, | |
146 | }, | |
147 | } | |
148 | ||
149 | #[allow(missing_docs_in_private_items)] | |
150 | pub enum PubBaz3 { | |
151 | PubBaz3A { | |
152 | b: isize | |
153 | }, | |
154 | } | |
155 | ||
156 | #[doc(hidden)] | |
157 | pub fn baz() {} | |
158 | ||
159 | ||
160 | const FOO: u32 = 0; | |
161 | /// dox | |
162 | pub const FOO1: u32 = 0; | |
163 | #[allow(missing_docs_in_private_items)] | |
164 | pub const FOO2: u32 = 0; | |
165 | #[doc(hidden)] | |
166 | pub const FOO3: u32 = 0; | |
167 | pub const FOO4: u32 = 0; | |
168 | ||
169 | ||
170 | static BAR: u32 = 0; | |
171 | /// dox | |
172 | pub static BAR1: u32 = 0; | |
173 | #[allow(missing_docs_in_private_items)] | |
174 | pub static BAR2: u32 = 0; | |
175 | #[doc(hidden)] | |
176 | pub static BAR3: u32 = 0; | |
177 | pub static BAR4: u32 = 0; | |
178 | ||
179 | ||
180 | mod internal_impl { | |
181 | /// dox | |
182 | pub fn documented() {} | |
183 | pub fn undocumented1() {} | |
184 | pub fn undocumented2() {} | |
185 | fn undocumented3() {} | |
186 | /// dox | |
187 | pub mod globbed { | |
188 | /// dox | |
189 | pub fn also_documented() {} | |
190 | pub fn also_undocumented1() {} | |
191 | fn also_undocumented2() {} | |
192 | } | |
193 | } | |
194 | /// dox | |
195 | pub mod public_interface { | |
196 | pub use internal_impl::documented as foo; | |
197 | pub use internal_impl::undocumented1 as bar; | |
198 | pub use internal_impl::{documented, undocumented2}; | |
199 | pub use internal_impl::globbed::*; | |
200 | } | |
201 | ||
202 | fn main() {} |