]> git.lizzy.rs Git - rust.git/blob - tests/ui/missing_doc.rs
Fixup a few tests needing asm support
[rust.git] / tests / ui / missing_doc.rs
1 // needs-asm-support
2 // aux-build: proc_macro_with_span.rs
3
4 #![warn(clippy::missing_docs_in_private_items)]
5 // When denying at the crate level, be sure to not get random warnings from the
6 // injected intrinsics by the compiler.
7 #![allow(dead_code)]
8 //! Some garbage docs for the crate here
9 #![doc = "More garbage"]
10
11 extern crate proc_macro_with_span;
12
13 use proc_macro_with_span::with_span;
14 use std::arch::global_asm;
15
16 type Typedef = String;
17 pub type PubTypedef = String;
18
19 mod module_no_dox {}
20 pub mod pub_module_no_dox {}
21
22 /// dox
23 pub fn foo() {}
24 pub fn foo2() {}
25 fn foo3() {}
26 #[allow(clippy::missing_docs_in_private_items)]
27 pub fn foo4() {}
28
29 // It sure is nice if doc(hidden) implies allow(missing_docs), and that it
30 // applies recursively
31 #[doc(hidden)]
32 mod a {
33     pub fn baz() {}
34     pub mod b {
35         pub fn baz() {}
36     }
37 }
38
39 enum Baz {
40     BazA { a: isize, b: isize },
41     BarB,
42 }
43
44 pub enum PubBaz {
45     PubBazA { a: isize },
46 }
47
48 /// dox
49 pub enum PubBaz2 {
50     /// dox
51     PubBaz2A {
52         /// dox
53         a: isize,
54     },
55 }
56
57 #[allow(clippy::missing_docs_in_private_items)]
58 pub enum PubBaz3 {
59     PubBaz3A { b: isize },
60 }
61
62 #[doc(hidden)]
63 pub fn baz() {}
64
65 const FOO: u32 = 0;
66 /// dox
67 pub const FOO1: u32 = 0;
68 #[allow(clippy::missing_docs_in_private_items)]
69 pub const FOO2: u32 = 0;
70 #[doc(hidden)]
71 pub const FOO3: u32 = 0;
72 pub const FOO4: u32 = 0;
73
74 static BAR: u32 = 0;
75 /// dox
76 pub static BAR1: u32 = 0;
77 #[allow(clippy::missing_docs_in_private_items)]
78 pub static BAR2: u32 = 0;
79 #[doc(hidden)]
80 pub static BAR3: u32 = 0;
81 pub static BAR4: u32 = 0;
82
83 mod internal_impl {
84     /// dox
85     pub fn documented() {}
86     pub fn undocumented1() {}
87     pub fn undocumented2() {}
88     fn undocumented3() {}
89     /// dox
90     pub mod globbed {
91         /// dox
92         pub fn also_documented() {}
93         pub fn also_undocumented1() {}
94         fn also_undocumented2() {}
95     }
96 }
97 /// dox
98 pub mod public_interface {
99     pub use crate::internal_impl::documented as foo;
100     pub use crate::internal_impl::globbed::*;
101     pub use crate::internal_impl::undocumented1 as bar;
102     pub use crate::internal_impl::{documented, undocumented2};
103 }
104
105 fn main() {}
106
107 // Ensure global asm doesn't require documentation.
108 global_asm! { "" }
109
110 // Don't lint proc macro output with an unexpected span.
111 with_span!(span pub struct FooPm { pub field: u32});
112 with_span!(span pub struct FooPm2;);
113 with_span!(span pub enum FooPm3 { A, B(u32), C { field: u32 }});
114 with_span!(span pub fn foo_pm() {});
115 with_span!(span pub static FOO_PM: u32 = 0;);
116 with_span!(span pub const FOO2_PM: u32 = 0;);