about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorAndy Russell <arussell123@gmail.com>2019-01-23 13:44:43 -0500
committerAndy Russell <arussell123@gmail.com>2019-03-08 12:39:47 -0500
commit018d4d265fb40ea4301da5dc339bff962a6faa57 (patch)
tree4d695838b5065d254d2b952bb77a51f93acce9f3 /src/test
parent2a65cbeea78c2c79b1030a0012cdea475104a44f (diff)
downloadrust-018d4d265fb40ea4301da5dc339bff962a6faa57.tar.gz
rust-018d4d265fb40ea4301da5dc339bff962a6faa57.zip
improve unused doc comment diagnostic reporting
Report all unused attributes on a given doc comment instead of just the
first one, and extend the span of sugared doc comments to encompass the
whole comment.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/useless_comment.rs8
-rw-r--r--src/test/ui/useless_comment.stderr24
2 files changed, 26 insertions, 6 deletions
diff --git a/src/test/ui/useless_comment.rs b/src/test/ui/useless_comment.rs
index 531eec007fc..e8a0e3c10d2 100644
--- a/src/test/ui/useless_comment.rs
+++ b/src/test/ui/useless_comment.rs
@@ -4,7 +4,9 @@ fn foo() {
     /// a //~ ERROR doc comment not used by rustdoc
     let x = 12;
 
-    /// b //~ doc comment not used by rustdoc
+    /// multi-line //~ doc comment not used by rustdoc
+    /// doc comment
+    /// that is unused
     match x {
         /// c //~ ERROR doc comment not used by rustdoc
         1 => {},
@@ -13,6 +15,10 @@ fn foo() {
 
     /// foo //~ ERROR doc comment not used by rustdoc
     unsafe {}
+
+    #[doc = "foo"] //~ ERROR doc comment not used by rustdoc
+    #[doc = "bar"] //~ ERROR doc comment not used by rustdoc
+    3;
 }
 
 fn main() {
diff --git a/src/test/ui/useless_comment.stderr b/src/test/ui/useless_comment.stderr
index cc818f6ce7c..a284c08f47a 100644
--- a/src/test/ui/useless_comment.stderr
+++ b/src/test/ui/useless_comment.stderr
@@ -13,20 +13,34 @@ LL | #![deny(unused_doc_comments)]
 error: doc comment not used by rustdoc
   --> $DIR/useless_comment.rs:7:5
    |
-LL |     /// b //~ doc comment not used by rustdoc
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | /     /// multi-line //~ doc comment not used by rustdoc
+LL | |     /// doc comment
+LL | |     /// that is unused
+   | |______________________^
 
 error: doc comment not used by rustdoc
-  --> $DIR/useless_comment.rs:9:9
+  --> $DIR/useless_comment.rs:11:9
    |
 LL |         /// c //~ ERROR doc comment not used by rustdoc
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: doc comment not used by rustdoc
-  --> $DIR/useless_comment.rs:14:5
+  --> $DIR/useless_comment.rs:16:5
    |
 LL |     /// foo //~ ERROR doc comment not used by rustdoc
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: aborting due to 4 previous errors
+error: doc comment not used by rustdoc
+  --> $DIR/useless_comment.rs:19:5
+   |
+LL |     #[doc = "foo"] //~ ERROR doc comment not used by rustdoc
+   |     ^^^^^^^^^^^^^^
+
+error: doc comment not used by rustdoc
+  --> $DIR/useless_comment.rs:20:5
+   |
+LL |     #[doc = "bar"] //~ ERROR doc comment not used by rustdoc
+   |     ^^^^^^^^^^^^^^
+
+error: aborting due to 6 previous errors