diff options
| author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2022-03-02 17:58:49 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2022-03-02 20:06:46 +0100 |
| commit | fce6cecf7a9247ca8abc9f1ac55ce30f93ad4346 (patch) | |
| tree | 7a0875e6a5a55f6b229aecde74d756bb666b322c | |
| parent | 628fbdf9b7a831a35e948abdb97f72f071c79ba5 (diff) | |
| download | rust-fce6cecf7a9247ca8abc9f1ac55ce30f93ad4346.tar.gz rust-fce6cecf7a9247ca8abc9f1ac55ce30f93ad4346.zip | |
Update unused_doc_comments ui test
| -rw-r--r-- | src/test/ui/lint/unused/unused-doc-comments-edge-cases.rs | 14 | ||||
| -rw-r--r-- | src/test/ui/lint/unused/unused-doc-comments-edge-cases.stderr | 28 |
2 files changed, 41 insertions, 1 deletions
diff --git a/src/test/ui/lint/unused/unused-doc-comments-edge-cases.rs b/src/test/ui/lint/unused/unused-doc-comments-edge-cases.rs index 258f9e4831f..54d86c31fb4 100644 --- a/src/test/ui/lint/unused/unused-doc-comments-edge-cases.rs +++ b/src/test/ui/lint/unused/unused-doc-comments-edge-cases.rs @@ -29,4 +29,18 @@ fn doc_comment_on_expr(num: u8) -> bool { fn doc_comment_on_generic<#[doc = "x"] T>(val: T) {} //~^ ERROR: unused doc comment +fn doc_comment_on_block() { + /// unused doc comment + //~^ ERROR: unused doc comment + { + let x = 12; + } +} + +/// unused doc comment +//~^ ERROR: unused doc comment +extern "C" { + fn foo(); +} + fn main() {} diff --git a/src/test/ui/lint/unused/unused-doc-comments-edge-cases.stderr b/src/test/ui/lint/unused/unused-doc-comments-edge-cases.stderr index 3ce1df71a2e..30a96af583a 100644 --- a/src/test/ui/lint/unused/unused-doc-comments-edge-cases.stderr +++ b/src/test/ui/lint/unused/unused-doc-comments-edge-cases.stderr @@ -49,6 +49,32 @@ LL | fn doc_comment_on_generic<#[doc = "x"] T>(val: T) {} | = help: use `//` for a plain comment +error: unused doc comment + --> $DIR/unused-doc-comments-edge-cases.rs:33:5 + | +LL | /// unused doc comment + | ^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | / { +LL | | let x = 12; +LL | | } + | |_____- rustdoc does not generate documentation for expressions + | + = help: use `//` for a plain comment + +error: unused doc comment + --> $DIR/unused-doc-comments-edge-cases.rs:40:1 + | +LL | /// unused doc comment + | ^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | / extern "C" { +LL | | fn foo(); +LL | | } + | |_- rustdoc does not generate documentation for extern block + | + = help: use `//` for a plain comment + error[E0308]: mismatched types --> $DIR/unused-doc-comments-edge-cases.rs:14:9 | @@ -63,7 +89,7 @@ help: you might have meant to return this value LL | return true; | ++++++ + -error: aborting due to 6 previous errors +error: aborting due to 8 previous errors Some errors have detailed explanations: E0308, E0658. For more information about an error, try `rustc --explain E0308`. |
