From 88cd25e85fd62d1a58e3e46cbf7151cd3ca155c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20K=C4=85dzio=C5=82ka?= Date: Wed, 24 Feb 2021 15:46:03 +0100 Subject: [PATCH] Add a test for invalid name in default specification --- test_suite/ui/invalid_name_in_default.rs | 11 +++++++++++ test_suite/ui/invalid_name_in_default.stderr | 11 +++++++++++ 2 files changed, 22 insertions(+) create mode 100644 test_suite/ui/invalid_name_in_default.rs create mode 100644 test_suite/ui/invalid_name_in_default.stderr diff --git a/test_suite/ui/invalid_name_in_default.rs b/test_suite/ui/invalid_name_in_default.rs new file mode 100644 index 0000000..0e92e62 --- /dev/null +++ b/test_suite/ui/invalid_name_in_default.rs @@ -0,0 +1,11 @@ +use enumflags2::bitflags; + +#[bitflags(default = A | C)] +#[repr(u8)] +#[derive(Clone, Copy)] +enum Test { + A = 1, + B = 2, +} + +fn main() {} diff --git a/test_suite/ui/invalid_name_in_default.stderr b/test_suite/ui/invalid_name_in_default.stderr new file mode 100644 index 0000000..9c8f56e --- /dev/null +++ b/test_suite/ui/invalid_name_in_default.stderr @@ -0,0 +1,11 @@ +error[E0599]: no variant or associated item named `C` found for enum `Test` in the current scope + --> $DIR/invalid_name_in_default.rs:3:26 + | +3 | #[bitflags(default = A | C)] + | ^ + | | + | variant or associated item not found in `Test` + | help: there is a variant with a similar name: `A` +... +6 | enum Test { + | --------- variant or associated item `C` not found here