https://gcc.gnu.org/g:f4055dd4086c3ac48cba8787d390c21a3af017a1
commit r17-5145-gf4055dd4086c3ac48cba8787d390c21a3af017a1 Author: Philip Herron <[email protected]> Date: Thu Sep 10 21:43:46 2026 +0100 gccrs: add ParamType::clone recusion guard gcc/rust/ChangeLog: * typecheck/rust-tyty.cc (ParamType::clone): add guard Signed-off-by: Philip Herron <[email protected]> Diff: --- gcc/rust/typecheck/rust-tyty.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc index 51adb831e4cd..93061b1fcf6f 100644 --- a/gcc/rust/typecheck/rust-tyty.cc +++ b/gcc/rust/typecheck/rust-tyty.cc @@ -3810,6 +3810,13 @@ ParamType::get_name () const BaseType * ParamType::clone () const { + static std::vector<HirId> active; + bool cycle = Resolver::ScopedPush<HirId>::contains (active, get_ty_ref ()); + if (cycle) + return new ParamType (is_trait_self, get_symbol (), ident.locus, get_ref (), + get_ty_ref (), {}, get_combined_refs ()); + + Resolver::ScopedPush<HirId> guard (active, get_ty_ref ()); return new ParamType (is_trait_self, get_symbol (), ident.locus, get_ref (), get_ty_ref (), get_specified_bounds (), get_combined_refs ());
