Skip to content

Commit 9866136

Browse files
Add tests for #[doc(keyword = "...")] and update other doc attributes tests
1 parent 8a35b93 commit 9866136

6 files changed

+52
-11
lines changed

Diff for: src/test/rustdoc-ui/check-doc-alias-attr.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
error: doc alias attribute expects a string: #[doc(alias = "0")]
1+
error: doc alias attribute expects a string: #[doc(alias = "a")]
22
--> $DIR/check-doc-alias-attr.rs:6:7
33
|
44
LL | #[doc(alias)]
55
| ^^^^^
66

7-
error: doc alias attribute expects a string: #[doc(alias = "0")]
7+
error: doc alias attribute expects a string: #[doc(alias = "a")]
88
--> $DIR/check-doc-alias-attr.rs:7:7
99
|
1010
LL | #[doc(alias = 0)]
1111
| ^^^^^^^^^
1212

13-
error: doc alias attribute expects a string: #[doc(alias = "0")]
13+
error: doc alias attribute expects a string: #[doc(alias = "a")]
1414
--> $DIR/check-doc-alias-attr.rs:8:7
1515
|
1616
LL | #[doc(alias("bar"))]

Diff for: src/test/ui/check-doc-alias-attr.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
error: doc alias attribute expects a string: #[doc(alias = "0")]
1+
error: doc alias attribute expects a string: #[doc(alias = "a")]
22
--> $DIR/check-doc-alias-attr.rs:7:7
33
|
44
LL | #[doc(alias)]
55
| ^^^^^
66

7-
error: doc alias attribute expects a string: #[doc(alias = "0")]
7+
error: doc alias attribute expects a string: #[doc(alias = "a")]
88
--> $DIR/check-doc-alias-attr.rs:8:7
99
|
1010
LL | #[doc(alias = 0)]
1111
| ^^^^^^^^^
1212

13-
error: doc alias attribute expects a string: #[doc(alias = "0")]
13+
error: doc alias attribute expects a string: #[doc(alias = "a")]
1414
--> $DIR/check-doc-alias-attr.rs:9:7
1515
|
1616
LL | #[doc(alias("bar"))]

Diff for: src/test/ui/doc-alias-crate-level.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@
44

55
#![crate_type = "lib"]
66

7-
#![doc(alias = "shouldn't work!")] //~ ERROR
7+
#![doc(alias = "not working!")] //~ ERROR
8+
9+
#[doc(alias = "shouldn't work!")] //~ ERROR
10+
pub struct Foo;

Diff for: src/test/ui/doc-alias-crate-level.stderr

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
error: '\'' character isn't allowed in `#[doc(alias = "...")]`
2-
--> $DIR/doc-alias-crate-level.rs:7:16
2+
--> $DIR/doc-alias-crate-level.rs:9:15
33
|
4-
LL | #![doc(alias = "shouldn't work!")]
5-
| ^^^^^^^^^^^^^^^^^
4+
LL | #[doc(alias = "shouldn't work!")]
5+
| ^^^^^^^^^^^^^^^^^
66

7-
error: aborting due to previous error
7+
error: `#![doc(alias = "...")]` isn't allowed as a crate level attribute
8+
--> $DIR/doc-alias-crate-level.rs:7:8
9+
|
10+
LL | #![doc(alias = "not working!")]
11+
| ^^^^^^^^^^^^^^^^^^^^^^
12+
13+
error: aborting due to 2 previous errors
814

Diff for: src/test/ui/doc_keyword.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#![crate_type = "lib"]
2+
#![feature(doc_keyword)]
3+
4+
#![doc(keyword = "hello")] //~ ERROR
5+
6+
#[doc(keyword = "hell")] //~ ERROR
7+
mod foo {
8+
fn hell() {}
9+
}
10+
11+
#[doc(keyword = "hall")] //~ ERROR
12+
fn foo() {}

Diff for: src/test/ui/doc_keyword.stderr

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
error: `#[doc(keyword = "...")]` can only be used on empty modules
2+
--> $DIR/doc_keyword.rs:6:7
3+
|
4+
LL | #[doc(keyword = "hell")]
5+
| ^^^^^^^^^^^^^^^^
6+
7+
error: `#[doc(keyword = "...")]` can only be used on modules
8+
--> $DIR/doc_keyword.rs:11:7
9+
|
10+
LL | #[doc(keyword = "hall")]
11+
| ^^^^^^^^^^^^^^^^
12+
13+
error: `#![doc(keyword = "...")]` isn't allowed as a crate level attribute
14+
--> $DIR/doc_keyword.rs:4:8
15+
|
16+
LL | #![doc(keyword = "hello")]
17+
| ^^^^^^^^^^^^^^^^^
18+
19+
error: aborting due to 3 previous errors
20+

0 commit comments

Comments
 (0)