From: Philip Herron <[email protected]>
gcc/rust/ChangeLog:
* typecheck/rust-tyty.cc (ParamType::clone): add guard
Signed-off-by: Philip Herron <[email protected]>
---
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/9bde421dcdf888b02984d0d505fe364ba0e3f087
The commit has NOT been mentioned in any issue.
The commit has been mentioned in the following pull-request(s):
- https://github.com/Rust-GCC/gccrs/pull/4909
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 51adb831e..93061b1fc 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 ());
base-commit: d53db1aaddcf746e73859b6082c37093d1870550
--
2.55.0