File tree 2 files changed +94
-0
lines changed
2 files changed +94
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ // compile-flags: --test --document-private-items
12
+ // should-fail
13
+
14
+ // issue #30094: rustdoc runs doctests on private items even though those docs don't appear
15
+ //
16
+ // in this version, we show that passing --document-private-items causes the private doctests to
17
+ // run
18
+
19
+ mod private {
20
+ /// Does all the work.
21
+ ///
22
+ /// ```
23
+ /// panic!("oh no");
24
+ /// ```
25
+ pub fn real_job ( a : u32 , b : u32 ) -> u32 {
26
+ return a + b;
27
+ }
28
+ }
29
+
30
+ pub mod public {
31
+ use super :: private;
32
+
33
+ /// ```
34
+ /// // this was originally meant to link to public::function but we can't do that here
35
+ /// assert_eq!(2+2, 4);
36
+ /// ```
37
+ pub fn function ( a : u32 , b : u32 ) -> u32 {
38
+ return complex_helper ( a, b) ;
39
+ }
40
+
41
+ /// Helps with stuff.
42
+ ///
43
+ /// ```
44
+ /// panic!("oh no");
45
+ /// ```
46
+ fn complex_helper ( a : u32 , b : u32 ) -> u32 {
47
+ return private:: real_job ( a, b) ;
48
+ }
49
+ }
Original file line number Diff line number Diff line change
1
+ // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ // compile-flags: --test
12
+
13
+ // issue #30094: rustdoc runs doctests on private items even though those docs don't appear
14
+
15
+ mod private {
16
+ /// Does all the work.
17
+ ///
18
+ /// ```
19
+ /// panic!("oh no");
20
+ /// ```
21
+ pub fn real_job ( a : u32 , b : u32 ) -> u32 {
22
+ return a + b;
23
+ }
24
+ }
25
+
26
+ pub mod public {
27
+ use super :: private;
28
+
29
+ /// ```
30
+ /// // this was originally meant to link to public::function but we can't do that here
31
+ /// assert_eq!(2+2, 4);
32
+ /// ```
33
+ pub fn function ( a : u32 , b : u32 ) -> u32 {
34
+ return complex_helper ( a, b) ;
35
+ }
36
+
37
+ /// Helps with stuff.
38
+ ///
39
+ /// ```
40
+ /// panic!("oh no");
41
+ /// ```
42
+ fn complex_helper ( a : u32 , b : u32 ) -> u32 {
43
+ return private:: real_job ( a, b) ;
44
+ }
45
+ }
You can’t perform that action at this time.
0 commit comments