]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Fix unify code on ADT's to check defid
authorPhilip Herron <herron.philip@googlemail.com>
Mon, 29 Jun 2026 17:06:14 +0000 (18:06 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Wed, 8 Jul 2026 15:22:52 +0000 (17:22 +0200)
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 <herron.philip@googlemail.com>
gcc/rust/typecheck/rust-unify.cc

index 719e21f449e37ffc4331dc1095c9a3c57f25a44e..32aebff52593f5e49682bce872028a96ba9dcd90 100644 (file)
@@ -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 ();