Skip to content

Commit 5e5b37b

Browse files
Add rustdoc ui test for new doc attribute parsing errors
1 parent 12bfc99 commit 5e5b37b

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Plain doc attribute
2+
#![doc("a")] //~ ERROR
3+
4+
// doc hidden
5+
#![doc(hidden = "a")] //~ ERROR
6+
#![doc(hidden = 12)] //~ ERROR
7+
#![doc(hidden())] //~ ERROR
8+
#![doc(hidden("a"))] //~ ERROR
9+
10+
// Error when `no_crate_inject` is used more than once.
11+
#![doc(test(no_crate_inject))]
12+
#![doc(test(no_crate_inject))] //~ ERROR
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
error[E0539]: malformed `doc` attribute input
2+
--> $DIR/doc-attr-errors.rs:2:1
3+
|
4+
LL | #![doc("a")]
5+
| ^^^^^^^---^^
6+
| |
7+
| expected this to be of the form `... = "..."`
8+
9+
error[E0565]: malformed `doc` attribute input
10+
--> $DIR/doc-attr-errors.rs:5:1
11+
|
12+
LL | #![doc(hidden = "a")]
13+
| ^^^^^^^^^^^^^^-----^^
14+
| |
15+
| didn't expect any arguments here
16+
17+
error[E0565]: malformed `doc` attribute input
18+
--> $DIR/doc-attr-errors.rs:6:1
19+
|
20+
LL | #![doc(hidden = 12)]
21+
| ^^^^^^^^^^^^^^----^^
22+
| |
23+
| didn't expect any arguments here
24+
25+
error[E0565]: malformed `doc` attribute input
26+
--> $DIR/doc-attr-errors.rs:7:1
27+
|
28+
LL | #![doc(hidden())]
29+
| ^^^^^^^^^^^^^--^^
30+
| |
31+
| didn't expect any arguments here
32+
33+
error[E0565]: malformed `doc` attribute input
34+
--> $DIR/doc-attr-errors.rs:8:1
35+
|
36+
LL | #![doc(hidden("a"))]
37+
| ^^^^^^^^^^^^^-----^^
38+
| |
39+
| didn't expect any arguments here
40+
41+
error[E0538]: malformed `doc` attribute input
42+
--> $DIR/doc-attr-errors.rs:12:1
43+
|
44+
LL | #![doc(test(no_crate_inject))]
45+
| ^^^^^^^^^^^^---------------^^^
46+
| |
47+
| found `no_crate_inject` used as a key more than once
48+
49+
error: aborting due to 6 previous errors
50+
51+
Some errors have detailed explanations: E0538, E0539, E0565.
52+
For more information about an error, try `rustc --explain E0538`.

0 commit comments

Comments
 (0)