https://gcc.gnu.org/g:559ead62d2fa5215df1de9577736cb1ae3b429d8

commit r17-4314-g559ead62d2fa5215df1de9577736cb1ae3b429d8
Author: Philip Herron <[email protected]>
Date:   Mon Aug 31 13:27:08 2026 +0100

    gccrs: Fix self referencial assocated type
    
    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 <[email protected]>

Diff:
---
 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 5be1989c55a4..502d0e8f7d8d 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

Reply via email to