]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Add test case to show bug is fixed
authorPhilip Herron <herron.philip@googlemail.com>
Wed, 24 Jun 2026 14:32:23 +0000 (15:32 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Wed, 8 Jul 2026 15:22:45 +0000 (17:22 +0200)
Fixes Rust-GCC#4481

gcc/testsuite/ChangeLog:

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

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

diff --git a/gcc/testsuite/rust/compile/issue-4481.rs b/gcc/testsuite/rust/compile/issue-4481.rs
new file mode 100644 (file)
index 0000000..32477d8
--- /dev/null
@@ -0,0 +1,25 @@
+#![feature(no_core, intrinsics, staged_api, lang_items)]
+#![no_core]
+
+#[lang = "sized"]
+pub trait Sized {}
+
+trait Trait<T: NewTrait> {}
+
+fn foo<T>()
+where
+    T: Trait<for<'b> fn(&'b u32)>, // { dg-error {bounds not satisfied for abi:rust fnptr .& u32 ,. -> .. .NewTrait. is not satisfied \[E0277\]} }
+{
+}
+
+impl<'a> Trait<fn(&'a u32)> for () {} // { dg-error {bounds not satisfied for abi:rust fnptr .& u32 ,. -> .. .NewTrait. is not satisfied \[E0277\]} }
+
+fn main() {
+    foo::<()>();
+}
+
+trait NewTrait {
+    type Assoc;
+    const C: Self::Assoc;
+    fn f(&self) -> Self::Assoc;
+}