]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Add test case to show issue is fixed
authorPhilip Herron <herron.philip@googlemail.com>
Thu, 17 Apr 2025 15:04:55 +0000 (16:04 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Mon, 28 Apr 2025 14:18:54 +0000 (16:18 +0200)
This was already fixed in: bb01719f0e1 but we require fn_once lang item
to be defined as we are working on libcore support still.

Fixes Rust-GCC#3711

gcc/testsuite/ChangeLog:

* rust/compile/issue-3711.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/testsuite/rust/compile/issue-3711.rs [new file with mode: 0644]

diff --git a/gcc/testsuite/rust/compile/issue-3711.rs b/gcc/testsuite/rust/compile/issue-3711.rs
new file mode 100644 (file)
index 0000000..a3f9c39
--- /dev/null
@@ -0,0 +1,17 @@
+#[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;
+}
+
+fn returns_closure() -> _ {
+    // { dg-error "the type placeholder ._. is not allowed within types on item signatures .E0121." "" { target *-*-* } .-1 }
+    || 0
+}
+
+fn main() {}