]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Add test case to show we emit better errors now
authorPhilip Herron <herron.philip@googlemail.com>
Fri, 11 Jul 2025 09:35:38 +0000 (10:35 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 5 Aug 2025 14:36:55 +0000 (16:36 +0200)
Fixes Rust-GCC#3144

gcc/testsuite/ChangeLog:

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

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

diff --git a/gcc/testsuite/rust/compile/issue-3144.rs b/gcc/testsuite/rust/compile/issue-3144.rs
new file mode 100644 (file)
index 0000000..4e61078
--- /dev/null
@@ -0,0 +1,29 @@
+#[lang = "sized"]
+pub trait Sized {}
+
+#[lang = "copy"]
+trait Copy {}
+
+#[lang = "clone"]
+pub trait Clone {
+    fn clone(&self) -> Self;
+}
+
+impl Clone for i32 {
+    fn clone(&self) -> i32 {
+        *self
+    }
+}
+
+struct S {}
+
+#[derive(Clone, Copy)]
+// { dg-error {bounds not satisfied for S .Clone. is not satisfied .E0277.} "" { target *-*-* } .-1 }
+struct S2 {
+    a: i32,
+    s: S,
+}
+
+fn main() -> i32 {
+    0
+}