1
Fork 0

Adjust tests/ui/attrs-resolution-errors.rs

- Move `tests/ui/attrs-resolution-errors.rs` to `tests/ui/resolve/`.
- Document test intent.
- Rename test to `attr-macros-positional-rejection.rs` to better reflect
  test intent.
This commit is contained in:
许杰友 Jieyou Xu (Joe) 2024-12-17 19:40:31 +08:00
parent 7424b898e9
commit 836a0e00e5
2 changed files with 15 additions and 6 deletions

View file

@ -1,3 +1,12 @@
//! Check that certain positions (listed below) only permit *non-macro* attributes and reject
//! attribute macros:
//!
//! - Enum variants
//! - Struct fields
//! - Field in a struct pattern
//! - Match arm
//! - Field in struct initialization expression
enum FooEnum { enum FooEnum {
#[test] #[test]
//~^ ERROR expected non-macro attribute, found attribute macro //~^ ERROR expected non-macro attribute, found attribute macro
@ -32,7 +41,7 @@ fn main() {
_ => {} _ => {}
} }
let _another_foo_strunct = FooStruct { let _another_foo_struct = FooStruct {
#[test] #[test]
//~^ ERROR expected non-macro attribute, found attribute macro //~^ ERROR expected non-macro attribute, found attribute macro
bar: 1, bar: 1,

View file

@ -1,29 +1,29 @@
error: expected non-macro attribute, found attribute macro `test` error: expected non-macro attribute, found attribute macro `test`
--> $DIR/attrs-resolution-errors.rs:2:7 --> $DIR/attr-macros-positional-rejection.rs:11:7
| |
LL | #[test] LL | #[test]
| ^^^^ not a non-macro attribute | ^^^^ not a non-macro attribute
error: expected non-macro attribute, found attribute macro `test` error: expected non-macro attribute, found attribute macro `test`
--> $DIR/attrs-resolution-errors.rs:8:7 --> $DIR/attr-macros-positional-rejection.rs:17:7
| |
LL | #[test] LL | #[test]
| ^^^^ not a non-macro attribute | ^^^^ not a non-macro attribute
error: expected non-macro attribute, found attribute macro `test` error: expected non-macro attribute, found attribute macro `test`
--> $DIR/attrs-resolution-errors.rs:23:15 --> $DIR/attr-macros-positional-rejection.rs:32:15
| |
LL | #[test] bar LL | #[test] bar
| ^^^^ not a non-macro attribute | ^^^^ not a non-macro attribute
error: expected non-macro attribute, found attribute macro `test` error: expected non-macro attribute, found attribute macro `test`
--> $DIR/attrs-resolution-errors.rs:30:11 --> $DIR/attr-macros-positional-rejection.rs:39:11
| |
LL | #[test] LL | #[test]
| ^^^^ not a non-macro attribute | ^^^^ not a non-macro attribute
error: expected non-macro attribute, found attribute macro `test` error: expected non-macro attribute, found attribute macro `test`
--> $DIR/attrs-resolution-errors.rs:36:11 --> $DIR/attr-macros-positional-rejection.rs:45:11
| |
LL | #[test] LL | #[test]
| ^^^^ not a non-macro attribute | ^^^^ not a non-macro attribute