File tree 2 files changed +41
-1
lines changed
2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -29,4 +29,18 @@ fn doc_comment_on_expr(num: u8) -> bool {
29
29
fn doc_comment_on_generic < #[ doc = "x" ] T > ( val : T ) { }
30
30
//~^ ERROR: unused doc comment
31
31
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
+
32
46
fn main ( ) { }
Original file line number Diff line number Diff line change @@ -49,6 +49,32 @@ LL | fn doc_comment_on_generic<#[doc = "x"] T>(val: T) {}
49
49
|
50
50
= help: use `//` for a plain comment
51
51
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
+
52
78
error[E0308]: mismatched types
53
79
--> $DIR/unused-doc-comments-edge-cases.rs:14:9
54
80
|
@@ -63,7 +89,7 @@ help: you might have meant to return this value
63
89
LL | return true;
64
90
| ++++++ +
65
91
66
- error: aborting due to 6 previous errors
92
+ error: aborting due to 8 previous errors
67
93
68
94
Some errors have detailed explanations: E0308, E0658.
69
95
For more information about an error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments