diff options
author | Philip Herron <herron.philip@googlemail.com> | 2025-08-01 11:52:16 +0100 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-08-05 16:37:02 +0200 |
commit | 481cb635fe58d022c1aac9f58b2266ed7280e88d (patch) | |
tree | 6e3b9bacf268785bfc394c57460046e37adfcae4 /gcc | |
parent | 26055423013bdfd07402482a1e7846b20569868a (diff) | |
download | gcc-481cb635fe58d022c1aac9f58b2266ed7280e88d.zip gcc-481cb635fe58d022c1aac9f58b2266ed7280e88d.tar.gz gcc-481cb635fe58d022c1aac9f58b2266ed7280e88d.tar.bz2 |
gccrs: Ensure we track the const generic substitution on the param mappings
gcc/rust/ChangeLog:
* typecheck/rust-tyty-subst.cc: track the const generic
* typecheck/rust-tyty.cc (ConstType::is_equal): finish the is_equal
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/typecheck/rust-tyty-subst.cc | 7 | ||||
-rw-r--r-- | gcc/rust/typecheck/rust-tyty.cc | 10 |
2 files changed, 13 insertions, 4 deletions
diff --git a/gcc/rust/typecheck/rust-tyty-subst.cc b/gcc/rust/typecheck/rust-tyty-subst.cc index 45c8cd6..6479109 100644 --- a/gcc/rust/typecheck/rust-tyty-subst.cc +++ b/gcc/rust/typecheck/rust-tyty-subst.cc @@ -163,8 +163,11 @@ SubstitutionParamMapping::fill_param_ty ( if (type.get_kind () == TypeKind::PARAM) { - // delete param; - param = static_cast<ParamType *> (type.clone ()); + param = static_cast<BaseGeneric *> (type.clone ()); + } + else if (type.get_kind () == TyTy::TypeKind::CONST) + { + param = static_cast<BaseGeneric *> (type.clone ()); } else if (param->get_kind () == TypeKind::PARAM) { diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc index c5488fc..d25f524 100644 --- a/gcc/rust/typecheck/rust-tyty.cc +++ b/gcc/rust/typecheck/rust-tyty.cc @@ -37,6 +37,7 @@ #include "options.h" #include "rust-system.h" #include "tree.h" +#include "fold-const.h" #include <string> namespace Rust { @@ -3712,9 +3713,14 @@ ConstType::is_equal (const BaseType &other) const return false; } - // TODO + const ConstType &rhs = static_cast<const ConstType &> (other); + if (!get_ty ()->is_equal (*rhs.get_ty ())) + return false; - return false; + tree lv = get_value (); + tree rv = rhs.get_value (); + + return operand_equal_p (lv, rv, 0); } ConstType * |