From f8ecf04f4b60f1004b9ba4092747f16d290dfff7 Mon Sep 17 00:00:00 2001 From: Kamlesh Kumar Date: Fri, 6 Dec 2019 10:52:28 +0530 Subject: accept union inside enum if not followed by identifier --- src/test/ui/enum/union-in-enum.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/test/ui/enum/union-in-enum.rs (limited to 'src/test/ui/enum') diff --git a/src/test/ui/enum/union-in-enum.rs b/src/test/ui/enum/union-in-enum.rs new file mode 100644 index 00000000000..048913e25cd --- /dev/null +++ b/src/test/ui/enum/union-in-enum.rs @@ -0,0 +1,13 @@ +// This test checks that the union keyword +// is accepted as the name of an enum variant +// when not followed by an identifier +// This special case exists because `union` is a contextual keyword. + +#![allow(warnings)] + +// check-pass + +enum A { union } +enum B { union {} } +enum C { union() } +fn main(){} -- cgit 1.4.1-3-g733a5