From c0296ee11b44e92a7f3bb6cd89dfe988ee511841 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Thu, 16 Mar 2023 00:15:54 -0700 Subject: [PATCH] Add ui test of malformed attribute containing expression --- test_suite/tests/ui/malformed/trailing_expr.rs | 9 +++++++++ test_suite/tests/ui/malformed/trailing_expr.stderr | 5 +++++ 2 files changed, 14 insertions(+) create mode 100644 test_suite/tests/ui/malformed/trailing_expr.rs create mode 100644 test_suite/tests/ui/malformed/trailing_expr.stderr diff --git a/test_suite/tests/ui/malformed/trailing_expr.rs b/test_suite/tests/ui/malformed/trailing_expr.rs new file mode 100644 index 000000000..f117e0231 --- /dev/null +++ b/test_suite/tests/ui/malformed/trailing_expr.rs @@ -0,0 +1,9 @@ +use serde_derive::Serialize; + +#[derive(Serialize)] +struct S { + #[serde(skip_serializing_if, x.is_empty())] + x: Vec<()>, +} + +fn main() {} diff --git a/test_suite/tests/ui/malformed/trailing_expr.stderr b/test_suite/tests/ui/malformed/trailing_expr.stderr new file mode 100644 index 000000000..d2a7ac975 --- /dev/null +++ b/test_suite/tests/ui/malformed/trailing_expr.stderr @@ -0,0 +1,5 @@ +error: expected `,` + --> tests/ui/malformed/trailing_expr.rs:5:35 + | +5 | #[serde(skip_serializing_if, x.is_empty())] + | ^