]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Add a test for enum variant name resolution
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Wed, 5 Mar 2025 10:56:49 +0000 (11:56 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Mon, 24 Mar 2025 12:07:17 +0000 (13:07 +0100)
Highlight the fact that a value inside an enum definition refers to
a struct outside of the enum and not to the enum variant's name
directly.

gcc/testsuite/ChangeLog:

* rust/compile/enum_variant_name.rs: New test.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/testsuite/rust/compile/enum_variant_name.rs [new file with mode: 0644]

diff --git a/gcc/testsuite/rust/compile/enum_variant_name.rs b/gcc/testsuite/rust/compile/enum_variant_name.rs
new file mode 100644 (file)
index 0000000..671fced
--- /dev/null
@@ -0,0 +1,12 @@
+// { dg-additional-options "-w -frust-name-resolution-2.0" }
+struct E1;
+
+enum Test {
+    E1 = {
+        let x = E1;
+        {
+            let x = E1;
+        }
+        0
+    },
+}