From 98553ce27e68e2d7b8fb3919c9aec7253dfd3a5a Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Sun, 10 Mar 2024 14:34:01 +0100 Subject: [PATCH] tests: Add ui/attributes/unix_sigpipe/unix_sigpipe-str-list.rs Which is a variant of [`unix_sigpipe-list.rs`][1] but where a string is used instead of an identifier. This makes it more similar to the proper form `#[unix_sigpipe = "sig_dfl"]` and thus more likely to be written by users by mistake. Also rename the first test to be more in line with the terminology of [The Reference][2]. [1]: https://github.com/rust-lang/rust/blob/master/tests/ui/attributes/unix_sigpipe/unix_sigpipe-list.rs [2]: https://doc.rust-lang.org/reference/attributes.html#meta-item-attribute-syntax --- .../{unix_sigpipe-list.rs => unix_sigpipe-ident-list.rs} | 0 ...sigpipe-list.stderr => unix_sigpipe-ident-list.stderr} | 2 +- tests/ui/attributes/unix_sigpipe/unix_sigpipe-str-list.rs | 4 ++++ .../attributes/unix_sigpipe/unix_sigpipe-str-list.stderr | 8 ++++++++ 4 files changed, 13 insertions(+), 1 deletion(-) rename tests/ui/attributes/unix_sigpipe/{unix_sigpipe-list.rs => unix_sigpipe-ident-list.rs} (100%) rename tests/ui/attributes/unix_sigpipe/{unix_sigpipe-list.stderr => unix_sigpipe-ident-list.stderr} (84%) create mode 100644 tests/ui/attributes/unix_sigpipe/unix_sigpipe-str-list.rs create mode 100644 tests/ui/attributes/unix_sigpipe/unix_sigpipe-str-list.stderr diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-list.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-ident-list.rs similarity index 100% rename from tests/ui/attributes/unix_sigpipe/unix_sigpipe-list.rs rename to tests/ui/attributes/unix_sigpipe/unix_sigpipe-ident-list.rs diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-list.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-ident-list.stderr similarity index 84% rename from tests/ui/attributes/unix_sigpipe/unix_sigpipe-list.stderr rename to tests/ui/attributes/unix_sigpipe/unix_sigpipe-ident-list.stderr index 66902f3ca9aa8..a020f21e6ca77 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-list.stderr +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-ident-list.stderr @@ -1,5 +1,5 @@ error: malformed `unix_sigpipe` attribute input - --> $DIR/unix_sigpipe-list.rs:3:1 + --> $DIR/unix_sigpipe-ident-list.rs:3:1 | LL | #[unix_sigpipe(sig_dfl)] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[unix_sigpipe = "inherit|sig_ign|sig_dfl"]` diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-str-list.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-str-list.rs new file mode 100644 index 0000000000000..22326835623bc --- /dev/null +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-str-list.rs @@ -0,0 +1,4 @@ +#![feature(unix_sigpipe)] + +#[unix_sigpipe("sig_dfl")] //~ error: malformed `unix_sigpipe` attribute input +fn main() {} diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-str-list.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-str-list.stderr new file mode 100644 index 0000000000000..b62c086e36059 --- /dev/null +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-str-list.stderr @@ -0,0 +1,8 @@ +error: malformed `unix_sigpipe` attribute input + --> $DIR/unix_sigpipe-str-list.rs:3:1 + | +LL | #[unix_sigpipe("sig_dfl")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[unix_sigpipe = "inherit|sig_ign|sig_dfl"]` + +error: aborting due to 1 previous error +