Skip to content

Commit ba436a8

Browse files
committed
fix missing_doc lint on private traits
Fixes #10069.
1 parent 886819c commit ba436a8

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/librustc/middle/lint.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -942,10 +942,9 @@ impl Visitor<()> for MissingDocLintVisitor {
942942
// trait (which was already linted)
943943
ast::item_impl(_, Some(*), _, _) => return,
944944

945-
ast::item_trait(*) if it.vis == ast::public => {
946-
self.check_attrs(it.attrs, it.id, it.span,
947-
~"missing documentation for a trait");
948-
}
945+
ast::item_trait(*) if it.vis != ast::public => return,
946+
ast::item_trait(*) => self.check_attrs(it.attrs, it.id, it.span,
947+
~"missing documentation for a trait"),
949948

950949
ast::item_fn(*) if it.vis == ast::public => {
951950
self.check_attrs(it.attrs, it.id, it.span,

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,9 @@ pub trait C {} //~ ERROR: missing documentation
4545
#[allow(missing_doc)] pub trait D {}
4646

4747
trait Bar {
48-
/// dox
4948
fn foo();
50-
fn foo2(); //~ ERROR: missing documentation
51-
fn foo3(); //~ ERROR: missing documentation
49+
fn foo_with_impl() {
50+
}
5251
}
5352

5453
impl Foo {

0 commit comments

Comments
 (0)