https://gcc.gnu.org/g:1fe3817daa73c8eba1180edccbca9b29a74e12af

commit r17-2254-g1fe3817daa73c8eba1180edccbca9b29a74e12af
Author: Philip Herron <[email protected]>
Date:   Mon Jun 29 18:06:14 2026 +0100

    gccrs: Fix unify code on ADT's to check defid
    
    There is a simple upfront check on ADT's we can check that def-id's match
    before continuing to unify them.
    
    gcc/rust/ChangeLog:
    
            * typecheck/rust-unify.cc (UnifyRules::expect_adt): check defid
    
    Signed-off-by: Philip Herron <[email protected]>

Diff:
---
 gcc/rust/typecheck/rust-unify.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/rust/typecheck/rust-unify.cc b/gcc/rust/typecheck/rust-unify.cc
index 719e21f449e3..32aebff52593 100644
--- a/gcc/rust/typecheck/rust-unify.cc
+++ b/gcc/rust/typecheck/rust-unify.cc
@@ -591,6 +591,11 @@ UnifyRules::expect_adt (TyTy::ADTType *ltype, 
TyTy::BaseType *rtype)
            return unify_error_type_node ();
          }
 
+       if (ltype->get_id () != type.get_id ())
+         {
+           return unify_error_type_node ();
+         }
+
        if (ltype->get_identifier ().compare (type.get_identifier ()) != 0)
          {
            return unify_error_type_node ();

Reply via email to