This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +41
-1
lines changed Expand file tree Collapse file tree 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 {
2929fn 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+
3246fn 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) {}
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+
5278error[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
6389LL | return true;
6490 | ++++++ +
6591
66- error: aborting due to 6 previous errors
92+ error: aborting due to 8 previous errors
6793
6894Some errors have detailed explanations: E0308, E0658.
6995For more information about an error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments