aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-04-28 12:25:26 +0100
committerPhilip Herron <philip.herron@embecosm.com>2022-04-28 12:25:26 +0100
commit712ae2f173df0c2d9018bf5ce708ffbbaee10d64 (patch)
tree44aacf2b029f4b284e6fc120bdf2df082ab21d47 /gcc
parent1ada076b9324982fd6f49aea6456e99613e394a8 (diff)
downloadgcc-712ae2f173df0c2d9018bf5ce708ffbbaee10d64.zip
gcc-712ae2f173df0c2d9018bf5ce708ffbbaee10d64.tar.gz
gcc-712ae2f173df0c2d9018bf5ce708ffbbaee10d64.tar.bz2
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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/typecheck/rust-tyty.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc
index 847ca88..0673d20 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 ())