Skip to content

Commit fce6cec

Browse files
Update unused_doc_comments ui test
1 parent 628fbdf commit fce6cec

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

src/test/ui/lint/unused/unused-doc-comments-edge-cases.rs

+14
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,18 @@ fn doc_comment_on_expr(num: u8) -> bool {
2929
fn doc_comment_on_generic<#[doc = "x"] T>(val: T) {}
3030
//~^ ERROR: unused doc comment
3131

32+
fn doc_comment_on_block() {
33+
/// unused doc comment
34+
//~^ ERROR: unused doc comment
35+
{
36+
let x = 12;
37+
}
38+
}
39+
40+
/// unused doc comment
41+
//~^ ERROR: unused doc comment
42+
extern "C" {
43+
fn foo();
44+
}
45+
3246
fn main() {}

src/test/ui/lint/unused/unused-doc-comments-edge-cases.stderr

+27-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,32 @@ LL | fn doc_comment_on_generic<#[doc = "x"] T>(val: T) {}
4949
|
5050
= help: use `//` for a plain comment
5151

52+
error: unused doc comment
53+
--> $DIR/unused-doc-comments-edge-cases.rs:33:5
54+
|
55+
LL | /// unused doc comment
56+
| ^^^^^^^^^^^^^^^^^^^^^^
57+
LL |
58+
LL | / {
59+
LL | | let x = 12;
60+
LL | | }
61+
| |_____- rustdoc does not generate documentation for expressions
62+
|
63+
= help: use `//` for a plain comment
64+
65+
error: unused doc comment
66+
--> $DIR/unused-doc-comments-edge-cases.rs:40:1
67+
|
68+
LL | /// unused doc comment
69+
| ^^^^^^^^^^^^^^^^^^^^^^
70+
LL |
71+
LL | / extern "C" {
72+
LL | | fn foo();
73+
LL | | }
74+
| |_- rustdoc does not generate documentation for extern block
75+
|
76+
= help: use `//` for a plain comment
77+
5278
error[E0308]: mismatched types
5379
--> $DIR/unused-doc-comments-edge-cases.rs:14:9
5480
|
@@ -63,7 +89,7 @@ help: you might have meant to return this value
6389
LL | return true;
6490
| ++++++ +
6591

66-
error: aborting due to 6 previous errors
92+
error: aborting due to 8 previous errors
6793

6894
Some errors have detailed explanations: E0308, E0658.
6995
For more information about an error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)