Skip to content

Commit 3625f00

Browse files
Add equivalent of existing tests in their 2024 edition form
1 parent eaec783 commit 3625f00

10 files changed

+138
-0
lines changed

tests/ui/attributes/doc-attr-2024.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// compile-flags: -Z unstable-options --edition 2024
2+
3+
#![crate_type = "lib"]
4+
#![doc(as_ptr)]
5+
//~^ ERROR unknown `doc` attribute
6+
7+
#[doc(as_ptr)]
8+
//~^ ERROR unknown `doc` attribute
9+
pub fn foo() {}
10+
11+
#[doc(123)]
12+
//~^ ERROR invalid `doc` attribute
13+
#[doc("hello", "bar")]
14+
//~^ ERROR invalid `doc` attribute
15+
//~| ERROR invalid `doc` attribute
16+
#[doc(foo::bar, crate::bar::baz = "bye")]
17+
//~^ ERROR unknown `doc` attribute
18+
//~| ERROR unknown `doc` attribute
19+
fn bar() {}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
error: unknown `doc` attribute `as_ptr`
2+
--> $DIR/doc-attr-2024.rs:7:7
3+
|
4+
LL | #[doc(as_ptr)]
5+
| ^^^^^^
6+
7+
error: invalid `doc` attribute
8+
--> $DIR/doc-attr-2024.rs:11:7
9+
|
10+
LL | #[doc(123)]
11+
| ^^^
12+
13+
error: invalid `doc` attribute
14+
--> $DIR/doc-attr-2024.rs:13:7
15+
|
16+
LL | #[doc("hello", "bar")]
17+
| ^^^^^^^
18+
19+
error: invalid `doc` attribute
20+
--> $DIR/doc-attr-2024.rs:13:16
21+
|
22+
LL | #[doc("hello", "bar")]
23+
| ^^^^^
24+
25+
error: unknown `doc` attribute `foo::bar`
26+
--> $DIR/doc-attr-2024.rs:16:7
27+
|
28+
LL | #[doc(foo::bar, crate::bar::baz = "bye")]
29+
| ^^^^^^^^
30+
31+
error: unknown `doc` attribute `crate::bar::baz`
32+
--> $DIR/doc-attr-2024.rs:16:17
33+
|
34+
LL | #[doc(foo::bar, crate::bar::baz = "bye")]
35+
| ^^^^^^^^^^^^^^^^^^^^^^^
36+
37+
error: unknown `doc` attribute `as_ptr`
38+
--> $DIR/doc-attr-2024.rs:4:8
39+
|
40+
LL | #![doc(as_ptr)]
41+
| ^^^^^^
42+
43+
error: aborting due to 7 previous errors
44+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// compile-flags: -Z unstable-options --edition 2024
2+
3+
#![doc(test(""))]
4+
//~^ ERROR `#![doc(test(...)]` does not take a literal
5+
6+
fn main() {}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: `#![doc(test(...)]` does not take a literal
2+
--> $DIR/doc-test-literal-2024.rs:3:13
3+
|
4+
LL | #![doc(test(""))]
5+
| ^^
6+
7+
error: aborting due to previous error
8+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// compile-flags: -Z unstable-options --edition 2024
2+
3+
#![crate_type = "lib"]
4+
5+
#[doc(owo)] //~ ERROR: unknown `doc` attribute
6+
pub struct Owo5;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: unknown `doc` attribute `owo`
2+
--> $DIR/invalid_repr_list_help-2024.rs:5:7
3+
|
4+
LL | #[doc(owo)]
5+
| ^^^
6+
7+
error: aborting due to previous error
8+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// compile-flags: -Z unstable-options --edition 2024
2+
3+
#[doc(primitive = "foo")]
4+
//~^ ERROR unknown `doc` attribute `primitive`
5+
mod bar {}
6+
7+
fn main() {}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: unknown `doc` attribute `primitive`
2+
--> $DIR/doc-primitive-2024.rs:3:7
3+
|
4+
LL | #[doc(primitive = "foo")]
5+
| ^^^^^^^^^^^^^^^^^
6+
7+
error: aborting due to previous error
8+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// compile-flags: -Z unstable-options --edition 2024
2+
3+
#![crate_type = "lib"]
4+
5+
#![doc(test)]
6+
//~^ ERROR `#[doc(test(...)]` takes a list of attributes
7+
#![doc(test = "hello")]
8+
//~^ ERROR `#[doc(test(...)]` takes a list of attributes
9+
#![doc(test(a))]
10+
//~^ ERROR unknown `doc(test)` attribute `a`
11+
12+
pub fn foo() {}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
error: `#[doc(test(...)]` takes a list of attributes
2+
--> $DIR/doc-test-attr-2024.rs:5:8
3+
|
4+
LL | #![doc(test)]
5+
| ^^^^
6+
7+
error: `#[doc(test(...)]` takes a list of attributes
8+
--> $DIR/doc-test-attr-2024.rs:7:8
9+
|
10+
LL | #![doc(test = "hello")]
11+
| ^^^^^^^^^^^^^^
12+
13+
error: unknown `doc(test)` attribute `a`
14+
--> $DIR/doc-test-attr-2024.rs:9:13
15+
|
16+
LL | #![doc(test(a))]
17+
| ^
18+
19+
error: aborting due to 3 previous errors
20+

0 commit comments

Comments
 (0)