about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-01-09 20:54:18 +0000
committerbors <bors@rust-lang.org>2020-01-09 20:54:18 +0000
commitab5de38577942e53e5a9e83e1ae0deca8b6c05e5 (patch)
tree6e6dc2fd459790c4cf17465aab563190214f91c1
parentac795a6f3aaaaa4d39afda0845e24891ca892126 (diff)
parent77e5a1b22765d983ac43193edd22b83a6d7d723e (diff)
downloadrust-ab5de38577942e53e5a9e83e1ae0deca8b6c05e5.tar.gz
rust-ab5de38577942e53e5a9e83e1ae0deca8b6c05e5.zip
Auto merge of #5030 - JohnTitor:split-missing-doc, r=phansch
Split up `missing-doc` ui test

Part of #2038

changelog: none
-rw-r--r--tests/ui/missing-doc-impl.rs87
-rw-r--r--tests/ui/missing-doc-impl.stderr103
-rw-r--r--tests/ui/missing-doc.rs81
-rw-r--r--tests/ui/missing-doc.stderr145
4 files changed, 214 insertions, 202 deletions
diff --git a/tests/ui/missing-doc-impl.rs b/tests/ui/missing-doc-impl.rs
new file mode 100644
index 00000000000..1317521f736
--- /dev/null
+++ b/tests/ui/missing-doc-impl.rs
@@ -0,0 +1,87 @@
+#![warn(clippy::missing_docs_in_private_items)]
+#![allow(dead_code)]
+#![feature(associated_type_defaults)]
+
+//! Some garbage docs for the crate here
+#![doc = "More garbage"]
+
+struct Foo {
+    a: isize,
+    b: isize,
+}
+
+pub struct PubFoo {
+    pub a: isize,
+    b: isize,
+}
+
+#[allow(clippy::missing_docs_in_private_items)]
+pub struct PubFoo2 {
+    pub a: isize,
+    pub c: isize,
+}
+
+/// dox
+pub trait A {
+    /// dox
+    fn foo(&self);
+    /// dox
+    fn foo_with_impl(&self) {}
+}
+
+#[allow(clippy::missing_docs_in_private_items)]
+trait B {
+    fn foo(&self);
+    fn foo_with_impl(&self) {}
+}
+
+pub trait C {
+    fn foo(&self);
+    fn foo_with_impl(&self) {}
+}
+
+#[allow(clippy::missing_docs_in_private_items)]
+pub trait D {
+    fn dummy(&self) {}
+}
+
+/// dox
+pub trait E {
+    type AssociatedType;
+    type AssociatedTypeDef = Self;
+
+    /// dox
+    type DocumentedType;
+    /// dox
+    type DocumentedTypeDef = Self;
+    /// dox
+    fn dummy(&self) {}
+}
+
+impl Foo {
+    pub fn foo() {}
+    fn bar() {}
+}
+
+impl PubFoo {
+    pub fn foo() {}
+    /// dox
+    pub fn foo1() {}
+    fn foo2() {}
+    #[allow(clippy::missing_docs_in_private_items)]
+    pub fn foo3() {}
+}
+
+#[allow(clippy::missing_docs_in_private_items)]
+trait F {
+    fn a();
+    fn b(&self);
+}
+
+// should need to redefine documentation for implementations of traits
+impl F for Foo {
+    fn a() {}
+    fn b(&self) {}
+}
+
+fn main() {}
diff --git a/tests/ui/missing-doc-impl.stderr b/tests/ui/missing-doc-impl.stderr
new file mode 100644
index 00000000000..9656a39abce
--- /dev/null
+++ b/tests/ui/missing-doc-impl.stderr
@@ -0,0 +1,103 @@
+error: missing documentation for a struct
+  --> $DIR/missing-doc-impl.rs:8:1
+   |
+LL | / struct Foo {
+LL | |     a: isize,
+LL | |     b: isize,
+LL | | }
+   | |_^
+   |
+   = note: `-D clippy::missing-docs-in-private-items` implied by `-D warnings`
+
+error: missing documentation for a struct field
+  --> $DIR/missing-doc-impl.rs:9:5
+   |
+LL |     a: isize,
+   |     ^^^^^^^^
+
+error: missing documentation for a struct field
+  --> $DIR/missing-doc-impl.rs:10:5
+   |
+LL |     b: isize,
+   |     ^^^^^^^^
+
+error: missing documentation for a struct
+  --> $DIR/missing-doc-impl.rs:13:1
+   |
+LL | / pub struct PubFoo {
+LL | |     pub a: isize,
+LL | |     b: isize,
+LL | | }
+   | |_^
+
+error: missing documentation for a struct field
+  --> $DIR/missing-doc-impl.rs:14:5
+   |
+LL |     pub a: isize,
+   |     ^^^^^^^^^^^^
+
+error: missing documentation for a struct field
+  --> $DIR/missing-doc-impl.rs:15:5
+   |
+LL |     b: isize,
+   |     ^^^^^^^^
+
+error: missing documentation for a trait
+  --> $DIR/missing-doc-impl.rs:38:1
+   |
+LL | / pub trait C {
+LL | |     fn foo(&self);
+LL | |     fn foo_with_impl(&self) {}
+LL | | }
+   | |_^
+
+error: missing documentation for a trait method
+  --> $DIR/missing-doc-impl.rs:39:5
+   |
+LL |     fn foo(&self);
+   |     ^^^^^^^^^^^^^^
+
+error: missing documentation for a trait method
+  --> $DIR/missing-doc-impl.rs:40:5
+   |
+LL |     fn foo_with_impl(&self) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: missing documentation for an associated type
+  --> $DIR/missing-doc-impl.rs:50:5
+   |
+LL |     type AssociatedType;
+   |     ^^^^^^^^^^^^^^^^^^^^
+
+error: missing documentation for an associated type
+  --> $DIR/missing-doc-impl.rs:51:5
+   |
+LL |     type AssociatedTypeDef = Self;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: missing documentation for a method
+  --> $DIR/missing-doc-impl.rs:62:5
+   |
+LL |     pub fn foo() {}
+   |     ^^^^^^^^^^^^^^^
+
+error: missing documentation for a method
+  --> $DIR/missing-doc-impl.rs:63:5
+   |
+LL |     fn bar() {}
+   |     ^^^^^^^^^^^
+
+error: missing documentation for a method
+  --> $DIR/missing-doc-impl.rs:67:5
+   |
+LL |     pub fn foo() {}
+   |     ^^^^^^^^^^^^^^^
+
+error: missing documentation for a method
+  --> $DIR/missing-doc-impl.rs:70:5
+   |
+LL |     fn foo2() {}
+   |     ^^^^^^^^^^^^
+
+error: aborting due to 15 previous errors
+
diff --git a/tests/ui/missing-doc.rs b/tests/ui/missing-doc.rs
index e65bce8e783..a9bf7140a1e 100644
--- a/tests/ui/missing-doc.rs
+++ b/tests/ui/missing-doc.rs
@@ -2,7 +2,7 @@
 // When denying at the crate level, be sure to not get random warnings from the
 // injected intrinsics by the compiler.
 #![allow(dead_code)]
-#![feature(associated_type_defaults, global_asm)]
+#![feature(global_asm)]
 
 //! Some garbage docs for the crate here
 #![doc = "More garbage"]
@@ -10,22 +10,6 @@
 type Typedef = String;
 pub type PubTypedef = String;
 
-struct Foo {
-    a: isize,
-    b: isize,
-}
-
-pub struct PubFoo {
-    pub a: isize,
-    b: isize,
-}
-
-#[allow(clippy::missing_docs_in_private_items)]
-pub struct PubFoo2 {
-    pub a: isize,
-    pub c: isize,
-}
-
 mod module_no_dox {}
 pub mod pub_module_no_dox {}
 
@@ -36,69 +20,6 @@ fn foo3() {}
 #[allow(clippy::missing_docs_in_private_items)]
 pub fn foo4() {}
 
-/// dox
-pub trait A {
-    /// dox
-    fn foo(&self);
-    /// dox
-    fn foo_with_impl(&self) {}
-}
-
-#[allow(clippy::missing_docs_in_private_items)]
-trait B {
-    fn foo(&self);
-    fn foo_with_impl(&self) {}
-}
-
-pub trait C {
-    fn foo(&self);
-    fn foo_with_impl(&self) {}
-}
-
-#[allow(clippy::missing_docs_in_private_items)]
-pub trait D {
-    fn dummy(&self) {}
-}
-
-/// dox
-pub trait E {
-    type AssociatedType;
-    type AssociatedTypeDef = Self;
-
-    /// dox
-    type DocumentedType;
-    /// dox
-    type DocumentedTypeDef = Self;
-    /// dox
-    fn dummy(&self) {}
-}
-
-impl Foo {
-    pub fn foo() {}
-    fn bar() {}
-}
-
-impl PubFoo {
-    pub fn foo() {}
-    /// dox
-    pub fn foo1() {}
-    fn foo2() {}
-    #[allow(clippy::missing_docs_in_private_items)]
-    pub fn foo3() {}
-}
-
-#[allow(clippy::missing_docs_in_private_items)]
-trait F {
-    fn a();
-    fn b(&self);
-}
-
-// should need to redefine documentation for implementations of traits
-impl F for Foo {
-    fn a() {}
-    fn b(&self) {}
-}
-
 // It sure is nice if doc(hidden) implies allow(missing_docs), and that it
 // applies recursively
 #[doc(hidden)]
diff --git a/tests/ui/missing-doc.stderr b/tests/ui/missing-doc.stderr
index a3ae62217a2..a876dc078eb 100644
--- a/tests/ui/missing-doc.stderr
+++ b/tests/ui/missing-doc.stderr
@@ -12,131 +12,32 @@ error: missing documentation for a type alias
 LL | pub type PubTypedef = String;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: missing documentation for a struct
-  --> $DIR/missing-doc.rs:13:1
-   |
-LL | / struct Foo {
-LL | |     a: isize,
-LL | |     b: isize,
-LL | | }
-   | |_^
-
-error: missing documentation for a struct field
-  --> $DIR/missing-doc.rs:14:5
-   |
-LL |     a: isize,
-   |     ^^^^^^^^
-
-error: missing documentation for a struct field
-  --> $DIR/missing-doc.rs:15:5
-   |
-LL |     b: isize,
-   |     ^^^^^^^^
-
-error: missing documentation for a struct
-  --> $DIR/missing-doc.rs:18:1
-   |
-LL | / pub struct PubFoo {
-LL | |     pub a: isize,
-LL | |     b: isize,
-LL | | }
-   | |_^
-
-error: missing documentation for a struct field
-  --> $DIR/missing-doc.rs:19:5
-   |
-LL |     pub a: isize,
-   |     ^^^^^^^^^^^^
-
-error: missing documentation for a struct field
-  --> $DIR/missing-doc.rs:20:5
-   |
-LL |     b: isize,
-   |     ^^^^^^^^
-
 error: missing documentation for a module
-  --> $DIR/missing-doc.rs:29:1
+  --> $DIR/missing-doc.rs:13:1
    |
 LL | mod module_no_dox {}
    | ^^^^^^^^^^^^^^^^^^^^
 
 error: missing documentation for a module
-  --> $DIR/missing-doc.rs:30:1
+  --> $DIR/missing-doc.rs:14:1
    |
 LL | pub mod pub_module_no_dox {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: missing documentation for a function
-  --> $DIR/missing-doc.rs:34:1
+  --> $DIR/missing-doc.rs:18:1
    |
 LL | pub fn foo2() {}
    | ^^^^^^^^^^^^^^^^
 
 error: missing documentation for a function
-  --> $DIR/missing-doc.rs:35:1
+  --> $DIR/missing-doc.rs:19:1
    |
 LL | fn foo3() {}
    | ^^^^^^^^^^^^
 
-error: missing documentation for a trait
-  --> $DIR/missing-doc.rs:53:1
-   |
-LL | / pub trait C {
-LL | |     fn foo(&self);
-LL | |     fn foo_with_impl(&self) {}
-LL | | }
-   | |_^
-
-error: missing documentation for a trait method
-  --> $DIR/missing-doc.rs:54:5
-   |
-LL |     fn foo(&self);
-   |     ^^^^^^^^^^^^^^
-
-error: missing documentation for a trait method
-  --> $DIR/missing-doc.rs:55:5
-   |
-LL |     fn foo_with_impl(&self) {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: missing documentation for an associated type
-  --> $DIR/missing-doc.rs:65:5
-   |
-LL |     type AssociatedType;
-   |     ^^^^^^^^^^^^^^^^^^^^
-
-error: missing documentation for an associated type
-  --> $DIR/missing-doc.rs:66:5
-   |
-LL |     type AssociatedTypeDef = Self;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: missing documentation for a method
-  --> $DIR/missing-doc.rs:77:5
-   |
-LL |     pub fn foo() {}
-   |     ^^^^^^^^^^^^^^^
-
-error: missing documentation for a method
-  --> $DIR/missing-doc.rs:78:5
-   |
-LL |     fn bar() {}
-   |     ^^^^^^^^^^^
-
-error: missing documentation for a method
-  --> $DIR/missing-doc.rs:82:5
-   |
-LL |     pub fn foo() {}
-   |     ^^^^^^^^^^^^^^^
-
-error: missing documentation for a method
-  --> $DIR/missing-doc.rs:85:5
-   |
-LL |     fn foo2() {}
-   |     ^^^^^^^^^^^^
-
 error: missing documentation for an enum
-  --> $DIR/missing-doc.rs:112:1
+  --> $DIR/missing-doc.rs:33:1
    |
 LL | / enum Baz {
 LL | |     BazA { a: isize, b: isize },
@@ -145,31 +46,31 @@ LL | | }
    | |_^
 
 error: missing documentation for a variant
-  --> $DIR/missing-doc.rs:113:5
+  --> $DIR/missing-doc.rs:34:5
    |
 LL |     BazA { a: isize, b: isize },
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: missing documentation for a struct field
-  --> $DIR/missing-doc.rs:113:12
+  --> $DIR/missing-doc.rs:34:12
    |
 LL |     BazA { a: isize, b: isize },
    |            ^^^^^^^^
 
 error: missing documentation for a struct field
-  --> $DIR/missing-doc.rs:113:22
+  --> $DIR/missing-doc.rs:34:22
    |
 LL |     BazA { a: isize, b: isize },
    |                      ^^^^^^^^
 
 error: missing documentation for a variant
-  --> $DIR/missing-doc.rs:114:5
+  --> $DIR/missing-doc.rs:35:5
    |
 LL |     BarB,
    |     ^^^^
 
 error: missing documentation for an enum
-  --> $DIR/missing-doc.rs:117:1
+  --> $DIR/missing-doc.rs:38:1
    |
 LL | / pub enum PubBaz {
 LL | |     PubBazA { a: isize },
@@ -177,43 +78,43 @@ LL | | }
    | |_^
 
 error: missing documentation for a variant
-  --> $DIR/missing-doc.rs:118:5
+  --> $DIR/missing-doc.rs:39:5
    |
 LL |     PubBazA { a: isize },
    |     ^^^^^^^^^^^^^^^^^^^^
 
 error: missing documentation for a struct field
-  --> $DIR/missing-doc.rs:118:15
+  --> $DIR/missing-doc.rs:39:15
    |
 LL |     PubBazA { a: isize },
    |               ^^^^^^^^
 
 error: missing documentation for a constant
-  --> $DIR/missing-doc.rs:138:1
+  --> $DIR/missing-doc.rs:59:1
    |
 LL | const FOO: u32 = 0;
    | ^^^^^^^^^^^^^^^^^^^
 
 error: missing documentation for a constant
-  --> $DIR/missing-doc.rs:145:1
+  --> $DIR/missing-doc.rs:66:1
    |
 LL | pub const FOO4: u32 = 0;
    | ^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: missing documentation for a static
-  --> $DIR/missing-doc.rs:147:1
+  --> $DIR/missing-doc.rs:68:1
    |
 LL | static BAR: u32 = 0;
    | ^^^^^^^^^^^^^^^^^^^^
 
 error: missing documentation for a static
-  --> $DIR/missing-doc.rs:154:1
+  --> $DIR/missing-doc.rs:75:1
    |
 LL | pub static BAR4: u32 = 0;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: missing documentation for a module
-  --> $DIR/missing-doc.rs:156:1
+  --> $DIR/missing-doc.rs:77:1
    |
 LL | / mod internal_impl {
 LL | |     /// dox
@@ -225,34 +126,34 @@ LL | | }
    | |_^
 
 error: missing documentation for a function
-  --> $DIR/missing-doc.rs:159:5
+  --> $DIR/missing-doc.rs:80:5
    |
 LL |     pub fn undocumented1() {}
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: missing documentation for a function
-  --> $DIR/missing-doc.rs:160:5
+  --> $DIR/missing-doc.rs:81:5
    |
 LL |     pub fn undocumented2() {}
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: missing documentation for a function
-  --> $DIR/missing-doc.rs:161:5
+  --> $DIR/missing-doc.rs:82:5
    |
 LL |     fn undocumented3() {}
    |     ^^^^^^^^^^^^^^^^^^^^^
 
 error: missing documentation for a function
-  --> $DIR/missing-doc.rs:166:9
+  --> $DIR/missing-doc.rs:87:9
    |
 LL |         pub fn also_undocumented1() {}
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: missing documentation for a function
-  --> $DIR/missing-doc.rs:167:9
+  --> $DIR/missing-doc.rs:88:9
    |
 LL |         fn also_undocumented2() {}
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: aborting due to 39 previous errors
+error: aborting due to 24 previous errors