public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] patterns: Add execution testcases to verify proper pattern matching
@ 2023-05-02  7:09 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2023-05-02  7:09 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:e70fbab606bdfa858d5993eddbc9d8070914a139

commit e70fbab606bdfa858d5993eddbc9d8070914a139
Author: Arthur Cohen <arthur.cohen@embecosm.com>
Date:   Fri Apr 21 11:22:52 2023 +0200

    patterns: Add execution testcases to verify proper pattern matching
    
    These testcases are similar to the ones added in #2072 but regarding
    execution. One more issue was opened from them - #2144
    
    gcc/testsuite/ChangeLog:
    
            * rust/execute/torture/issue-1852-1.rs: New test.
            * rust/execute/torture/issue-1852.rs: New test.

Diff:
---
 gcc/testsuite/rust/execute/torture/issue-1852-1.rs | 15 +++++++++++++++
 gcc/testsuite/rust/execute/torture/issue-1852.rs   | 15 +++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/gcc/testsuite/rust/execute/torture/issue-1852-1.rs b/gcc/testsuite/rust/execute/torture/issue-1852-1.rs
new file mode 100644
index 00000000000..1286c1b7bb2
--- /dev/null
+++ b/gcc/testsuite/rust/execute/torture/issue-1852-1.rs
@@ -0,0 +1,15 @@
+enum Foo {
+    A,
+    B(i32),
+}
+
+fn main() -> i32 {
+    let result = Foo::A;
+
+    let value = match result {
+        Foo::A => 15,
+        Foo::B(x) => x,
+    };
+
+    value - 15
+}
diff --git a/gcc/testsuite/rust/execute/torture/issue-1852.rs b/gcc/testsuite/rust/execute/torture/issue-1852.rs
new file mode 100644
index 00000000000..a8bf128891d
--- /dev/null
+++ b/gcc/testsuite/rust/execute/torture/issue-1852.rs
@@ -0,0 +1,15 @@
+enum Foo {
+    A,
+    B(i32),
+}
+
+fn main() -> i32 {
+    let result = Foo::B(123);
+
+    let value = match result {
+        Foo::A => 15,
+        Foo::B(x) => x,
+    };
+
+    value - 123
+}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-02  7:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-02  7:09 [gcc/devel/rust/master] patterns: Add execution testcases to verify proper pattern matching Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).