public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Fix equality interface on TyTy::FnType
@ 2022-06-08 12:39 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-08 12:39 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:712ae2f173df0c2d9018bf5ce708ffbbaee10d64

commit 712ae2f173df0c2d9018bf5ce708ffbbaee10d64
Author: Philip Herron <philip.herron@embecosm.com>
Date:   Thu Apr 28 12:25:26 2022 +0100

    Fix equality interface on TyTy::FnType
    
    We missed a case to ensure the substitutions are equal in the is_equal
    interface. This becomes important when dealing with generic associated
    types since the projections could end up overlapping and we need to
    differentiate them by the substitutions and monomorphization.

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

diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc
index 847ca88900f..0673d209f0e 100644
--- a/gcc/rust/typecheck/rust-tyty.cc
+++ b/gcc/rust/typecheck/rust-tyty.cc
@@ -1230,6 +1230,19 @@ FnType::is_equal (const BaseType &other) const
     {
       if (get_num_substitutions () != other2.get_num_substitutions ())
 	return false;
+
+      const FnType &ofn = static_cast<const FnType &> (other);
+      for (size_t i = 0; i < get_num_substitutions (); i++)
+	{
+	  const SubstitutionParamMapping &a = get_substs ().at (i);
+	  const SubstitutionParamMapping &b = ofn.get_substs ().at (i);
+
+	  const ParamType *pa = a.get_param_ty ();
+	  const ParamType *pb = b.get_param_ty ();
+
+	  if (!pa->is_equal (*pb))
+	    return false;
+	}
     }
 
   if (num_params () != other2.num_params ())


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-08 12:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 12:39 [gcc/devel/rust/master] Fix equality interface on TyTy::FnType Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).