This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Expand file tree Collapse file tree 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 {
10791079 fn check_expr ( & mut self , cx : & EarlyContext < ' _ > , expr : & ast:: Expr ) {
10801080 warn_if_doc ( cx, expr. span , "expressions" , & expr. attrs ) ;
10811081 }
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+ }
10821086}
10831087
10841088declare_lint ! {
Original file line number Diff line number Diff line change @@ -26,4 +26,7 @@ fn doc_comment_on_expr(num: u8) -> bool {
2626 num == 3
2727}
2828
29+ fn doc_comment_on_generic < #[ doc = "x" ] T > ( val : T ) { }
30+ //~^ ERROR: unused doc comment
31+
2932fn main ( ) { }
Original file line number Diff line number Diff line change @@ -41,6 +41,14 @@ LL | num == 3
4141 |
4242 = help: use `//` for a plain comment
4343
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+
4452error[E0308]: mismatched types
4553 --> $DIR/unused-doc-comments-edge-cases.rs:14:9
4654 |
@@ -55,7 +63,7 @@ help: you might have meant to return this value
5563LL | return true;
5664 | ++++++ +
5765
58- error: aborting due to 5 previous errors
66+ error: aborting due to 6 previous errors
5967
6068Some errors have detailed explanations: E0308, E0658.
6169For more information about an error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments