From 836a0e00e5d29b845748cf42713445076418473b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E6=9D=B0=E5=8F=8B=20Jieyou=20Xu=20=28Joe=29?= <39484203+jieyouxu@users.noreply.github.com> Date: Tue, 17 Dec 2024 19:40:31 +0800 Subject: [PATCH] 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. --- .../attr-macros-positional-rejection.rs} | 11 ++++++++++- .../attr-macros-positional-rejection.stderr} | 10 +++++----- 2 files changed, 15 insertions(+), 6 deletions(-) rename tests/ui/{attrs-resolution-errors.rs => resolve/attr-macros-positional-rejection.rs} (73%) rename tests/ui/{attrs-resolution-errors.stderr => resolve/attr-macros-positional-rejection.stderr} (73%) diff --git a/tests/ui/attrs-resolution-errors.rs b/tests/ui/resolve/attr-macros-positional-rejection.rs similarity index 73% rename from tests/ui/attrs-resolution-errors.rs rename to 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 similarity index 73% rename from tests/ui/attrs-resolution-errors.stderr rename to 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