[gccrs COMMIT] gccrs: Fix self referencial assocated type

gerris.rs@gmail.com gerris.rs@gmail.com
Mon Aug 31 20:52:11 GMT 2026


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

Fixes Rust-GCC/gccrs#4821

gcc/rust/ChangeLog:

	* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item): can be recusive

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/9b2b2ebeaa814bb86c8da2996e74b2c8b6ed0a4a

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

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

 gcc/rust/typecheck/rust-hir-trait-resolve.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/rust/typecheck/rust-hir-trait-resolve.cc b/gcc/rust/typecheck/rust-hir-trait-resolve.cc
index 5be1989c5..502d0e8f7 100644
--- a/gcc/rust/typecheck/rust-hir-trait-resolve.cc
+++ b/gcc/rust/typecheck/rust-hir-trait-resolve.cc
@@ -490,6 +490,8 @@ TraitItemReference::resolve_item (const TraitReference *tref,
 				TyTy::SubstitutionArgumentMappings::error (),
 				{}, {}, inherited_count);
 
+  context->insert_type (type.get_mappings (), projection);
+
   // Attach the bounds declared on the associated type itself:
   //
   //     type IntoIter: Iterator<Item = Self::Item>
@@ -514,8 +516,6 @@ TraitItemReference::resolve_item (const TraitReference *tref,
       if (!trait_item_bounds.empty ())
 	projection->inherit_bounds (trait_item_bounds);
     }
-
-  context->insert_type (type.get_mappings (), projection);
 }
 
 void

base-commit: c007e328479c591983717ff57322cf62a4b9b540
-- 
2.55.0



More information about the Gcc-rust mailing list