diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index 1ac14dfc4b1e..e1602ee0896d 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -942,10 +942,9 @@ impl Visitor<()> for MissingDocLintVisitor { // trait (which was already linted) ast::item_impl(_, Some(*), _, _) => return, - ast::item_trait(*) if it.vis == ast::public => { - self.check_attrs(it.attrs, it.id, it.span, - ~"missing documentation for a trait"); - } + ast::item_trait(*) if it.vis != ast::public => return, + ast::item_trait(*) => self.check_attrs(it.attrs, it.id, it.span, + ~"missing documentation for a trait"), ast::item_fn(*) if it.vis == ast::public => { self.check_attrs(it.attrs, it.id, it.span, diff --git a/src/test/compile-fail/lint-missing-doc.rs b/src/test/compile-fail/lint-missing-doc.rs index 22710ad90e87..463fd352c5a7 100644 --- a/src/test/compile-fail/lint-missing-doc.rs +++ b/src/test/compile-fail/lint-missing-doc.rs @@ -45,10 +45,9 @@ pub trait C {} //~ ERROR: missing documentation #[allow(missing_doc)] pub trait D {} trait Bar { - /// dox fn foo(); - fn foo2(); //~ ERROR: missing documentation - fn foo3(); //~ ERROR: missing documentation + fn foo_with_impl() { + } } impl Foo {