https://gcc.gnu.org/g:af7e7defb63bb05b8ba619f6b55730b8a1643c75
commit r17-2231-gaf7e7defb63bb05b8ba619f6b55730b8a1643c75 Author: Philip Herron <[email protected]> Date: Wed Jun 24 15:37:42 2026 +0100 gccrs: Add testcases to show gat issue is fixed Fixes Rust-GCC#4471 gcc/testsuite/ChangeLog: * rust/compile/issue-4471-1.rs: New test. * rust/compile/issue-4471-2.rs: New test. Signed-off-by: Philip Herron <[email protected]> Diff: --- gcc/testsuite/rust/compile/issue-4471-1.rs | 10 ++++++++++ gcc/testsuite/rust/compile/issue-4471-2.rs | 28 ++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/gcc/testsuite/rust/compile/issue-4471-1.rs b/gcc/testsuite/rust/compile/issue-4471-1.rs new file mode 100644 index 000000000000..9b06b8c6b8e4 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-4471-1.rs @@ -0,0 +1,10 @@ +#![feature(no_core, intrinsics, staged_api, lang_items)] +#![no_core] + +#[lang = "sized"] +pub trait Sized {} + +trait Foo<T> {} +trait Bar: Foo {} // { dg-error {generic item takes at least 1 type arguments but 0 were supplied \[E0107\]} } +impl<T> Bar for T {} +impl Foo<i32> for i32 {} diff --git a/gcc/testsuite/rust/compile/issue-4471-2.rs b/gcc/testsuite/rust/compile/issue-4471-2.rs new file mode 100644 index 000000000000..75db746f1c95 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-4471-2.rs @@ -0,0 +1,28 @@ +#![feature(no_core, intrinsics, staged_api, lang_items)] +#![no_core] + +#[lang = "sized"] +pub trait Sized {} + +trait Foo<T> { + fn get(&self) -> T; +} + +trait Bar: Foo<i32> + Foo { // { dg-error {generic item takes at least 1 type arguments but 0 were supplied \[E0107\]} } + fn double_get(&self) -> i32 { + self.get() + self.get() + } +} + +impl<T> Bar for T where T: Foo<i32> {} + +impl Foo<i32> for i32 { + fn get(&self) -> i32 { + *self + } +} + +fn main() { + let x: i32 = 1; + Bar::double_get(&x); +}
