From b60ec4fe0b09174ba9cea638c30eb961b621053e Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Thu, 26 Sep 2024 15:25:21 +0100 Subject: [PATCH] gccrs: add test case to show impl block on ! works 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 --- gcc/testsuite/rust/compile/issue-2951.rs | 13 +++++++++++++ gcc/testsuite/rust/compile/nr2/exclude | 1 + 2 files changed, 14 insertions(+) create mode 100644 gcc/testsuite/rust/compile/issue-2951.rs diff --git a/gcc/testsuite/rust/compile/issue-2951.rs b/gcc/testsuite/rust/compile/issue-2951.rs new file mode 100644 index 00000000000..d30a3bf2adf --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-2951.rs @@ -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 + } +} diff --git a/gcc/testsuite/rust/compile/nr2/exclude b/gcc/testsuite/rust/compile/nr2/exclude index 50781e56b85..c30af607edb 100644 --- a/gcc/testsuite/rust/compile/nr2/exclude +++ b/gcc/testsuite/rust/compile/nr2/exclude @@ -253,3 +253,4 @@ issue-3139-1.rs issue-3139-2.rs issue-3139-3.rs issue-3036.rs +issue-2951.rs