rustc_lint: Move unused_doc_comments from pre-expansion to early lints

This commit is contained in:
Vadim Petrochenkov 2020-02-15 12:38:34 +03:00
parent 19288ddfd6
commit bcd7e2b38b
3 changed files with 11 additions and 29 deletions

View file

@ -94,7 +94,7 @@ fn lint_mod(tcx: TyCtxt<'_>, module_def_id: DefId) {
macro_rules! pre_expansion_lint_passes {
($macro:path, $args:tt) => {
$macro!($args, [KeywordIdents: KeywordIdents, UnusedDocComment: UnusedDocComment,]);
$macro!($args, [KeywordIdents: KeywordIdents,]);
};
}
@ -114,6 +114,7 @@ macro_rules! early_lint_passes {
NonAsciiIdents: NonAsciiIdents,
IncompleteFeatures: IncompleteFeatures,
RedundantSemicolon: RedundantSemicolon,
UnusedDocComment: UnusedDocComment,
]
);
};

View file

@ -6,7 +6,7 @@ macro_rules! mac {
() => {}
}
/// foo //~ ERROR unused doc comment
/// foo //FIXME ERROR unused doc comment
mac!();
fn foo() {
@ -29,7 +29,7 @@ fn foo() {
#[doc = "bar"] //~ ERROR unused doc comment
3;
/// bar //~ ERROR unused doc comment
/// bar //FIXME ERROR unused doc comment
mac!();
let x = /** comment */ 47; //~ ERROR unused doc comment

View file

@ -1,18 +1,3 @@
error: unused doc comment
--> $DIR/useless-comment.rs:9:1
|
LL | /// foo
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | mac!();
| ------- rustdoc does not generate documentation for macro expansions
|
note: the lint level is defined here
--> $DIR/useless-comment.rs:3:9
|
LL | #![deny(unused_doc_comments)]
| ^^^^^^^^^^^^^^^^^^^
= help: to document an item produced by a macro, the macro must produce the documentation as part of its expansion
error: unused doc comment
--> $DIR/useless-comment.rs:13:5
|
@ -20,6 +5,12 @@ LL | /// a
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | let x = 12;
| ----------- rustdoc does not generate documentation for statements
|
note: the lint level is defined here
--> $DIR/useless-comment.rs:3:9
|
LL | #![deny(unused_doc_comments)]
| ^^^^^^^^^^^^^^^^^^^
error: unused doc comment
--> $DIR/useless-comment.rs:16:5
@ -68,16 +59,6 @@ LL | #[doc = "bar"]
LL | 3;
| - rustdoc does not generate documentation for expressions
error: unused doc comment
--> $DIR/useless-comment.rs:32:5
|
LL | /// bar
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | mac!();
| ------- rustdoc does not generate documentation for macro expansions
|
= help: to document an item produced by a macro, the macro must produce the documentation as part of its expansion
error: unused doc comment
--> $DIR/useless-comment.rs:35:13
|
@ -94,5 +75,5 @@ LL | |
LL | | }
| |_____- rustdoc does not generate documentation for expressions
error: aborting due to 10 previous errors
error: aborting due to 8 previous errors