[gccrs COMMIT 1/3] gccrs: Add test-case to show ice fixed

gerris.rs@gmail.com gerris.rs@gmail.com
Tue Sep 15 09:16:02 GMT 2026


From: Philip Herron <herron.philip@googlemail.com>

Fixes Rust-GCC/gccrs#4152

gcc/testsuite/ChangeLog:

	* rust/compile/issues/issue-4152.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
---
This change was merged into the gccrs repository and is posted here for
upstream visibility and potential drive-by review, as requested by GCC
release managers.
Each commit email contains a link to its details on github from where you can
find the Pull-Request and associated discussions.


Commit on github: https://github.com/Rust-GCC/gccrs/commit/d6d35c960bd51d2dc8475a0be9c1e3e4bdf47aeb

The commit has been mentioned in the following issue(s):
 - Rust-GCC/gccrs#4152: https://github.com/Rust-GCC/gccrs/issues/4152

The commit has been mentioned in the following pull-request(s):
 - https://github.com/Rust-GCC/gccrs/pull/4898

 .../rust/compile/issues/issue-4152.rs         | 36 +++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 gcc/testsuite/rust/compile/issues/issue-4152.rs

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 000000000..257fd55b8
--- /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()
+}

base-commit: 36860cbddb7e28cb0349911724c906acdb5689ea
-- 
2.55.0



More information about the Gcc-rust mailing list