public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-8852] gccrs: add test cases to prove type inference is working
@ 2024-02-07 12:44 Arthur Cohen
  0 siblings, 0 replies; only message in thread
From: Arthur Cohen @ 2024-02-07 12:44 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:9fecac88d3ce37d3c2c483ea712e48baf904f27b

commit r14-8852-g9fecac88d3ce37d3c2c483ea712e48baf904f27b
Author: Philip Herron <herron.philip@googlemail.com>
Date:   Sat Feb 3 16:02:36 2024 +0000

    gccrs: add test cases to prove type inference is working
    
    Fixes #2772
    
    gcc/testsuite/ChangeLog:
    
            * rust/compile/issue-2772-1.rs: New test.
            * rust/compile/issue-2772-2.rs: New test.

Diff:
---
 gcc/testsuite/rust/compile/issue-2772-1.rs | 20 ++++++++++++++++++++
 gcc/testsuite/rust/compile/issue-2772-2.rs | 20 ++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/gcc/testsuite/rust/compile/issue-2772-1.rs b/gcc/testsuite/rust/compile/issue-2772-1.rs
new file mode 100644
index 000000000000..69977db0bfb5
--- /dev/null
+++ b/gcc/testsuite/rust/compile/issue-2772-1.rs
@@ -0,0 +1,20 @@
+// { dg-options "-w" }
+#[lang = "sized"]
+pub trait Sized {}
+
+struct Pair<'a, T, U>
+where
+    T: 'a,
+    U: 'a,
+{
+    left: T,
+    right: U,
+}
+
+pub fn test<'a>() {
+    let a: i32 = 50;
+    let x = Pair {
+        left: &&a,
+        right: &a,
+    };
+}
diff --git a/gcc/testsuite/rust/compile/issue-2772-2.rs b/gcc/testsuite/rust/compile/issue-2772-2.rs
new file mode 100644
index 000000000000..b05f2b1dc2ba
--- /dev/null
+++ b/gcc/testsuite/rust/compile/issue-2772-2.rs
@@ -0,0 +1,20 @@
+// { dg-options "-w" }
+#[lang = "sized"]
+pub trait Sized {}
+
+struct Pair<'a, T, U>
+where
+    T: 'a,
+    U: 'a,
+{
+    left: T,
+    right: U,
+}
+
+pub fn test<'a>() {
+    let a: i32 = 50;
+    let x = Pair::<&'_ _, &'_ _> {
+        left: &&a,
+        right: &a,
+    };
+}

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

only message in thread, other threads:[~2024-02-07 12:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-07 12:44 [gcc r14-8852] gccrs: add test cases to prove type inference is working Arthur Cohen

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).