Skip to content

Commit e0d7497

Browse files
committed
Revert "Revert "Fix missing_docs lint for const and static.""
This reverts commit 9191a78.
1 parent 68f7928 commit e0d7497

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/librustc_lint/builtin.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1869,6 +1869,8 @@ impl LintPass for MissingDoc {
18691869
}
18701870
return
18711871
},
1872+
ast::ItemConst(..) => "a constant",
1873+
ast::ItemStatic(..) => "a static",
18721874
_ => return
18731875
};
18741876

src/test/compile-fail/lint-missing-doc.rs

+21
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,27 @@ pub enum PubBaz3 {
150150
#[doc(hidden)]
151151
pub fn baz() {}
152152

153+
154+
const FOO: u32 = 0;
155+
/// dox
156+
pub const FOO1: u32 = 0;
157+
#[allow(missing_docs)]
158+
pub const FOO2: u32 = 0;
159+
#[doc(hidden)]
160+
pub const FOO3: u32 = 0;
161+
pub const FOO4: u32 = 0; //~ ERROR: missing documentation for a const
162+
163+
164+
static BAR: u32 = 0;
165+
/// dox
166+
pub static BAR1: u32 = 0;
167+
#[allow(missing_docs)]
168+
pub static BAR2: u32 = 0;
169+
#[doc(hidden)]
170+
pub static BAR3: u32 = 0;
171+
pub static BAR4: u32 = 0; //~ ERROR: missing documentation for a static
172+
173+
153174
mod internal_impl {
154175
/// dox
155176
pub fn documented() {}

0 commit comments

Comments
 (0)