Skip to content

Commit 00130cf

Browse files
author
Eljay
committed
Fix missing_docs lint for const and static.
1 parent a38e758 commit 00130cf

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/librustc_lint/builtin.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,6 +1612,8 @@ impl LintPass for MissingDoc {
16121612
}
16131613
return
16141614
},
1615+
ast::ItemConst(..) => "a constant",
1616+
ast::ItemStatic(..) => "a static",
16151617
_ => return
16161618
};
16171619

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,27 @@ pub enum PubBaz3 {
149149
#[doc(hidden)]
150150
pub fn baz() {}
151151

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

0 commit comments

Comments
 (0)