Skip to content

Commit

Permalink
Add equivalent of existing tests in their 2024 edition form
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Nov 3, 2023
1 parent eaec783 commit 3625f00
Show file tree
Hide file tree
Showing 10 changed files with 138 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/ui/attributes/doc-attr-2024.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// compile-flags: -Z unstable-options --edition 2024

#![crate_type = "lib"]
#![doc(as_ptr)]
//~^ ERROR unknown `doc` attribute

#[doc(as_ptr)]
//~^ ERROR unknown `doc` attribute
pub fn foo() {}

#[doc(123)]
//~^ ERROR invalid `doc` attribute
#[doc("hello", "bar")]
//~^ ERROR invalid `doc` attribute
//~| ERROR invalid `doc` attribute
#[doc(foo::bar, crate::bar::baz = "bye")]
//~^ ERROR unknown `doc` attribute
//~| ERROR unknown `doc` attribute
fn bar() {}
44 changes: 44 additions & 0 deletions tests/ui/attributes/doc-attr-2024.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
error: unknown `doc` attribute `as_ptr`
--> $DIR/doc-attr-2024.rs:7:7
|
LL | #[doc(as_ptr)]
| ^^^^^^

error: invalid `doc` attribute
--> $DIR/doc-attr-2024.rs:11:7
|
LL | #[doc(123)]
| ^^^

error: invalid `doc` attribute
--> $DIR/doc-attr-2024.rs:13:7
|
LL | #[doc("hello", "bar")]
| ^^^^^^^

error: invalid `doc` attribute
--> $DIR/doc-attr-2024.rs:13:16
|
LL | #[doc("hello", "bar")]
| ^^^^^

error: unknown `doc` attribute `foo::bar`
--> $DIR/doc-attr-2024.rs:16:7
|
LL | #[doc(foo::bar, crate::bar::baz = "bye")]
| ^^^^^^^^

error: unknown `doc` attribute `crate::bar::baz`
--> $DIR/doc-attr-2024.rs:16:17
|
LL | #[doc(foo::bar, crate::bar::baz = "bye")]
| ^^^^^^^^^^^^^^^^^^^^^^^

error: unknown `doc` attribute `as_ptr`
--> $DIR/doc-attr-2024.rs:4:8
|
LL | #![doc(as_ptr)]
| ^^^^^^

error: aborting due to 7 previous errors

6 changes: 6 additions & 0 deletions tests/ui/attributes/doc-test-literal-2024.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// compile-flags: -Z unstable-options --edition 2024

#![doc(test(""))]
//~^ ERROR `#![doc(test(...)]` does not take a literal

fn main() {}
8 changes: 8 additions & 0 deletions tests/ui/attributes/doc-test-literal-2024.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: `#![doc(test(...)]` does not take a literal
--> $DIR/doc-test-literal-2024.rs:3:13
|
LL | #![doc(test(""))]
| ^^

error: aborting due to previous error

6 changes: 6 additions & 0 deletions tests/ui/repr/invalid_repr_list_help-2024.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// compile-flags: -Z unstable-options --edition 2024

#![crate_type = "lib"]

#[doc(owo)] //~ ERROR: unknown `doc` attribute
pub struct Owo5;
8 changes: 8 additions & 0 deletions tests/ui/repr/invalid_repr_list_help-2024.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: unknown `doc` attribute `owo`
--> $DIR/invalid_repr_list_help-2024.rs:5:7
|
LL | #[doc(owo)]
| ^^^

error: aborting due to previous error

7 changes: 7 additions & 0 deletions tests/ui/rustdoc/doc-primitive-2024.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// compile-flags: -Z unstable-options --edition 2024

#[doc(primitive = "foo")]
//~^ ERROR unknown `doc` attribute `primitive`
mod bar {}

fn main() {}
8 changes: 8 additions & 0 deletions tests/ui/rustdoc/doc-primitive-2024.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: unknown `doc` attribute `primitive`
--> $DIR/doc-primitive-2024.rs:3:7
|
LL | #[doc(primitive = "foo")]
| ^^^^^^^^^^^^^^^^^

error: aborting due to previous error

12 changes: 12 additions & 0 deletions tests/ui/rustdoc/doc-test-attr-2024.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// compile-flags: -Z unstable-options --edition 2024

#![crate_type = "lib"]

#![doc(test)]
//~^ ERROR `#[doc(test(...)]` takes a list of attributes
#![doc(test = "hello")]
//~^ ERROR `#[doc(test(...)]` takes a list of attributes
#![doc(test(a))]
//~^ ERROR unknown `doc(test)` attribute `a`

pub fn foo() {}
20 changes: 20 additions & 0 deletions tests/ui/rustdoc/doc-test-attr-2024.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
error: `#[doc(test(...)]` takes a list of attributes
--> $DIR/doc-test-attr-2024.rs:5:8
|
LL | #![doc(test)]
| ^^^^

error: `#[doc(test(...)]` takes a list of attributes
--> $DIR/doc-test-attr-2024.rs:7:8
|
LL | #![doc(test = "hello")]
| ^^^^^^^^^^^^^^

error: unknown `doc(test)` attribute `a`
--> $DIR/doc-test-attr-2024.rs:9:13
|
LL | #![doc(test(a))]
| ^

error: aborting due to 3 previous errors

0 comments on commit 3625f00

Please sign in to comment.