public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-8851] gccrs: add testcase to prove issue has already been fixed
@ 2024-02-07 12:43 Arthur Cohen
  0 siblings, 0 replies; only message in thread
From: Arthur Cohen @ 2024-02-07 12:43 UTC (permalink / raw)
  To: gcc-cvs

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

commit r14-8851-gce096d34662574f435a16f2af157d5a44361f781
Author: Philip Herron <herron.philip@googlemail.com>
Date:   Sat Feb 3 15:43:59 2024 +0000

    gccrs: add testcase to prove issue has already been fixed
    
    Fixes #1483
    
    gcc/testsuite/ChangeLog:
    
            * rust/compile/issue-1483.rs: New test.

Diff:
---
 gcc/testsuite/rust/compile/issue-1483.rs | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/gcc/testsuite/rust/compile/issue-1483.rs b/gcc/testsuite/rust/compile/issue-1483.rs
new file mode 100644
index 000000000000..eda7e139283d
--- /dev/null
+++ b/gcc/testsuite/rust/compile/issue-1483.rs
@@ -0,0 +1,28 @@
+#[lang = "sized"]
+pub trait Sized {}
+
+#[lang = "fn_once"]
+pub trait FnOnce<Args> {
+    #[lang = "fn_once_output"]
+    type Output;
+
+    extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
+}
+
+pub fn takes_fn_generic<F: FnOnce(i32) -> i32>(a: i32, f: F) -> i32 {
+    f(a)
+}
+
+pub fn takes_fn_generic_where<F>(a: i32, f: F) -> i32
+where
+    F: FnOnce(i32) -> i32,
+{
+    f(a)
+}
+
+pub fn test() {
+    let foo = |x: i32| -> i32 { x + 1 };
+
+    takes_fn_generic(1, foo);
+    takes_fn_generic_where(2, foo);
+}

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

only message in thread, other threads:[~2024-02-07 12:43 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:43 [gcc r14-8851] gccrs: add testcase to prove issue has already been fixed 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).