about summary refs log tree commit diff
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2024-12-17 19:40:31 +0800
committer许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2024-12-17 19:57:42 +0800
commit836a0e00e5d29b845748cf42713445076418473b (patch)
tree776ad47e0896dca3611c09ded944ed787c0f8c0e
parent7424b898e94b019b49e0854ec061abfdc071e61e (diff)
downloadrust-836a0e00e5d29b845748cf42713445076418473b.tar.gz
rust-836a0e00e5d29b845748cf42713445076418473b.zip
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.
-rw-r--r--tests/ui/resolve/attr-macros-positional-rejection.rs (renamed from tests/ui/attrs-resolution-errors.rs)11
-rw-r--r--tests/ui/resolve/attr-macros-positional-rejection.stderr (renamed from tests/ui/attrs-resolution-errors.stderr)10
2 files changed, 15 insertions, 6 deletions
diff --git a/tests/ui/attrs-resolution-errors.rs b/tests/ui/resolve/attr-macros-positional-rejection.rs
index 8770fb1ded8..11382ff1399 100644
--- a/tests/ui/attrs-resolution-errors.rs
+++ b/tests/ui/resolve/attr-macros-positional-rejection.rs
@@ -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 {
     #[test]
     //~^ 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]
         //~^ ERROR expected non-macro attribute, found attribute macro
         bar: 1,
diff --git a/tests/ui/attrs-resolution-errors.stderr b/tests/ui/resolve/attr-macros-positional-rejection.stderr
index 883f96e5c19..faea511f315 100644
--- a/tests/ui/attrs-resolution-errors.stderr
+++ b/tests/ui/resolve/attr-macros-positional-rejection.stderr
@@ -1,29 +1,29 @@
 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]
    |       ^^^^ not a non-macro attribute
 
 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]
    |       ^^^^ not a non-macro attribute
 
 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
    |               ^^^^ not a non-macro attribute
 
 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]
    |           ^^^^ not a non-macro attribute
 
 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]
    |           ^^^^ not a non-macro attribute