https://gcc.gnu.org/g:fa95a83e1aca79e4ee4b110f8e725c16d400a5c0
commit r17-5132-gfa95a83e1aca79e4ee4b110f8e725c16d400a5c0 Author: Philip Herron <[email protected]> Date: Mon Sep 14 21:46:29 2026 +0100 gccrs: Add test-case to show ice fixed Fixes Rust-GCC/gccrs#4152 gcc/testsuite/ChangeLog: * rust/compile/issues/issue-4152.rs: New test. Signed-off-by: Philip Herron <[email protected]> Diff: --- gcc/testsuite/rust/compile/issues/issue-4152.rs | 36 +++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/gcc/testsuite/rust/compile/issues/issue-4152.rs b/gcc/testsuite/rust/compile/issues/issue-4152.rs new file mode 100644 index 000000000000..257fd55b8ca2 --- /dev/null +++ b/gcc/testsuite/rust/compile/issues/issue-4152.rs @@ -0,0 +1,36 @@ +#![feature(no_core, lang_items)] +#![no_core] + +#[lang = "sized"] +pub trait Sized {} + +impl<'a> Thing for &'a u8 { + type Output = u8; + + fn calc(&mut self) -> u8 { + **self + } +} + +trait Thing { + type Output: 'static; + + fn calc(&mut self) -> Self::Output; +} + +impl<'a> Thing for &'a u8 { + type Output = u8; + + fn calc(&mut self) -> u8 { + **self + } +} + +fn get_thing(x: &u8) -> impl Thing + '_ { + x +} + +fn f(n: &u8) -> impl Thing + 'static { // { dg-error "bounds not satisfied for u8 .Thing. is not satisfied" } + let mut t = get_thing(n); + t.calc() +}
