File tree 3 files changed +16
-1
lines changed
3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -1079,6 +1079,10 @@ impl EarlyLintPass for UnusedDocComment {
1079
1079
fn check_expr ( & mut self , cx : & EarlyContext < ' _ > , expr : & ast:: Expr ) {
1080
1080
warn_if_doc ( cx, expr. span , "expressions" , & expr. attrs ) ;
1081
1081
}
1082
+
1083
+ fn check_generic_param ( & mut self , cx : & EarlyContext < ' _ > , param : & ast:: GenericParam ) {
1084
+ warn_if_doc ( cx, param. ident . span , "generic parameters" , & param. attrs ) ;
1085
+ }
1082
1086
}
1083
1087
1084
1088
declare_lint ! {
Original file line number Diff line number Diff line change @@ -26,4 +26,7 @@ fn doc_comment_on_expr(num: u8) -> bool {
26
26
num == 3
27
27
}
28
28
29
+ fn doc_comment_on_generic < #[ doc = "x" ] T > ( val : T ) { }
30
+ //~^ ERROR: unused doc comment
31
+
29
32
fn main ( ) { }
Original file line number Diff line number Diff line change @@ -41,6 +41,14 @@ LL | num == 3
41
41
|
42
42
= help: use `//` for a plain comment
43
43
44
+ error: unused doc comment
45
+ --> $DIR/unused-doc-comments-edge-cases.rs:29:27
46
+ |
47
+ LL | fn doc_comment_on_generic<#[doc = "x"] T>(val: T) {}
48
+ | ^^^^^^^^^^^^ - rustdoc does not generate documentation for generic parameters
49
+ |
50
+ = help: use `//` for a plain comment
51
+
44
52
error[E0308]: mismatched types
45
53
--> $DIR/unused-doc-comments-edge-cases.rs:14:9
46
54
|
@@ -55,7 +63,7 @@ help: you might have meant to return this value
55
63
LL | return true;
56
64
| ++++++ +
57
65
58
- error: aborting due to 5 previous errors
66
+ error: aborting due to 6 previous errors
59
67
60
68
Some errors have detailed explanations: E0308, E0658.
61
69
For more information about an error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments