Skip to content

Commit fc7f2a3

Browse files
committed
Add test cases for unused math attrs
1 parent 3bb683a commit fc7f2a3

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#![feature(rustdoc_texmath)]
2+
#![deny(unused_doc_comments)]
3+
4+
#[doc(syntax="+tex_math_dollars")]
5+
pub fn foo() {}
6+
7+
pub fn bar() {
8+
#[doc(syntax="+tex_math_dollars")]
9+
// there should be an unused_doc_comments line here
10+
fn baz() {}
11+
#[doc(syntax="+tex_math_dollars")]
12+
// there should be an unused_doc_comments line here
13+
struct Baz;
14+
}
15+
16+
#[doc(syntax="+tex_math_dollars")]
17+
//~^ ERROR unused_doc_comments
18+
unsafe extern "C" {
19+
pub unsafe fn quux();
20+
}
21+
22+
unsafe extern "C" {
23+
#[doc(syntax="+tex_math_dollars")]
24+
pub unsafe fn zzyzx();
25+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
error: unused doc comment
2+
--> $DIR/unused-doc-syntax.rs:16:1
3+
|
4+
LL | #[doc(syntax="+tex_math_dollars")]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
LL |
7+
LL | / unsafe extern "C" {
8+
LL | | pub unsafe fn quux();
9+
LL | | }
10+
| |_- rustdoc does not generate documentation for extern blocks
11+
|
12+
= help: use `//` for a plain comment
13+
note: the lint level is defined here
14+
--> $DIR/unused-doc-syntax.rs:2:9
15+
|
16+
LL | #![deny(unused_doc_comments)]
17+
| ^^^^^^^^^^^^^^^^^^^
18+
19+
error: aborting due to 1 previous error
20+

0 commit comments

Comments
 (0)