summary refs log tree commit diff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorDavid Creswick <dcrewi@gyrae.net>2013-11-11 22:17:47 -0600
committerDavid Creswick <dcrewi@gyrae.net>2013-11-13 11:31:59 -0600
commit1f7eb4f9aae43cb1177e2cf67a799a63b911ea78 (patch)
tree0e17edd4ee83da9638cb94025d172fc414fe4bee /src/test/compile-fail
parent4d9b95fada7c97ac1c63099bab1d45ba120958ec (diff)
downloadrust-1f7eb4f9aae43cb1177e2cf67a799a63b911ea78.tar.gz
rust-1f7eb4f9aae43cb1177e2cf67a799a63b911ea78.zip
make missing_doc lint respect the visibility rules
Previously, the `exported_items` set created by the privacy pass was
incomplete. Specifically, it did not include items that had been defined
at a private path but then `pub use`d at a public path. This commit
finds all crate exports during the privacy pass. Consequently, some code
in the reachable pass and in rustdoc is no longer necessary. This commit
then removes the separate `MissingDocLintVisitor` lint pass, opting to
check missing_doc lint in the same pass as the other lint checkers using
the visibility result computed by the privacy pass.

Fixes #9777.
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/lint-missing-doc.rs44
1 files changed, 36 insertions, 8 deletions
diff --git a/src/test/compile-fail/lint-missing-doc.rs b/src/test/compile-fail/lint-missing-doc.rs
index 463fd352c5a..c866462a3e9 100644
--- a/src/test/compile-fail/lint-missing-doc.rs
+++ b/src/test/compile-fail/lint-missing-doc.rs
@@ -11,6 +11,7 @@
 // When denying at the crate level, be sure to not get random warnings from the
 // injected intrinsics by the compiler.
 #[feature(struct_variant)];
+#[feature(globs)];
 #[deny(missing_doc)];
 
 struct Foo {
@@ -39,16 +40,21 @@ fn foo3() {}
 #[allow(missing_doc)] pub fn foo4() {}
 
 /// dox
-pub trait A {}
-trait B {}
-pub trait C {} //~ ERROR: missing documentation
-#[allow(missing_doc)] pub trait D {}
-
-trait Bar {
+pub trait A {
+    /// dox
     fn foo();
-    fn foo_with_impl() {
-    }
+    /// dox
+    fn foo_with_impl() {}
 }
+trait B {
+    fn foo();
+    fn foo_with_impl() {}
+}
+pub trait C { //~ ERROR: missing documentation
+    fn foo(); //~ ERROR: missing documentation
+    fn foo_with_impl() {} //~ ERROR: missing documentation
+}
+#[allow(missing_doc)] pub trait D {}
 
 impl Foo {
     pub fn foo() {} //~ ERROR: missing documentation
@@ -120,4 +126,26 @@ pub enum PubBaz3 {
 #[doc(hidden)]
 pub fn baz() {}
 
+mod internal_impl {
+    /// dox
+    pub fn documented() {}
+    pub fn undocumented1() {} //~ ERROR: missing documentation
+    pub fn undocumented2() {} //~ ERROR: missing documentation
+    fn undocumented3() {}
+    /// dox
+    pub mod globbed {
+        /// dox
+        pub fn also_documented() {}
+        pub fn also_undocumented1() {} //~ ERROR: missing documentation
+        fn also_undocumented2() {}
+    }
+}
+/// dox
+pub mod public_interface {
+    pub use foo = internal_impl::documented;
+    pub use bar = internal_impl::undocumented1;
+    pub use internal_impl::{documented, undocumented2};
+    pub use internal_impl::globbed::*;
+}
+
 fn main() {}