]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: add test case to show impl block on ! works
authorPhilip Herron <herron.philip@googlemail.com>
Thu, 26 Sep 2024 14:25:21 +0000 (15:25 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Wed, 19 Mar 2025 14:32:16 +0000 (15:32 +0100)
The resolution with ! was fixed in: 09cfe530f9c this adds a
test case to show the other issue is also fixed.

Fixes #2951

gcc/testsuite/ChangeLog:

* rust/compile/nr2/exclude: nr2 is crashing here
* rust/compile/issue-2951.rs: New test.

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

diff --git a/gcc/testsuite/rust/compile/issue-2951.rs b/gcc/testsuite/rust/compile/issue-2951.rs
new file mode 100644 (file)
index 0000000..d30a3bf
--- /dev/null
@@ -0,0 +1,13 @@
+#[lang = "sized"]
+pub trait Sized {}
+
+#[lang = "clone"]
+pub trait Clone: Sized {
+    fn clone(&self) -> Self;
+}
+
+impl Clone for ! {
+    fn clone(&self) -> Self {
+        *self
+    }
+}
index 50781e56b85e4d6d697c9c7dcc3532734a4266aa..c30af607edb4a887e56c904bbf7be973df2421e3 100644 (file)
@@ -253,3 +253,4 @@ issue-3139-1.rs
 issue-3139-2.rs
 issue-3139-3.rs
 issue-3036.rs
+issue-2951.rs