[gcc r15-8792] gccrs: Get rid of duplicate interface gccrs#3396
Arthur Cohen
cohenarthur@gcc.gnu.org
Mon Mar 24 12:35:20 GMT 2025
https://gcc.gnu.org/g:90376526038ec469f9037a90619ab04089e3a7f0
commit r15-8792-g90376526038ec469f9037a90619ab04089e3a7f0
Author: GS-GOAT <86884129+GS-GOAT@users.noreply.github.com>
Date: Sat Feb 8 12:03:18 2025 +0530
gccrs: Get rid of duplicate interface gccrs#3396
gcc/rust/ChangeLog:
* typecheck/rust-autoderef.cc
(insert_implicit_type): Update single-parameter call to
pass explicit HirId.
* typecheck/rust-hir-type-check-expr.cc: Same.
* typecheck/rust-hir-type-check-pattern.cc: Same.
* typecheck/rust-hir-type-check.h: Removed call
to the duplicate interface.
* typecheck/rust-typecheck-context.cc
(TypeCheckContext::insert_implicit_type): Removed the
interface with no HirId field.
Signed-off-by: Guransh Singh <guransh766@gmail.com>
Diff:
---
gcc/rust/typecheck/rust-autoderef.cc | 2 +-
gcc/rust/typecheck/rust-hir-type-check-expr.cc | 2 +-
gcc/rust/typecheck/rust-hir-type-check-pattern.cc | 3 ++-
gcc/rust/typecheck/rust-hir-type-check.h | 1 -
gcc/rust/typecheck/rust-typecheck-context.cc | 7 -------
5 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/gcc/rust/typecheck/rust-autoderef.cc b/gcc/rust/typecheck/rust-autoderef.cc
index 75da3919ea4b..6aa20a8c9414 100644
--- a/gcc/rust/typecheck/rust-autoderef.cc
+++ b/gcc/rust/typecheck/rust-autoderef.cc
@@ -113,7 +113,7 @@ Adjuster::try_unsize_type (TyTy::BaseType *ty)
auto slice
= new TyTy::SliceType (mappings.get_next_hir_id (), ty->get_ident ().locus,
TyTy::TyVar (slice_elem->get_ref ()));
- context->insert_implicit_type (slice);
+ context->insert_implicit_type (slice->get_ref (), slice);
return Adjustment (Adjustment::AdjustmentType::UNSIZE, ty, slice);
}
diff --git a/gcc/rust/typecheck/rust-hir-type-check-expr.cc b/gcc/rust/typecheck/rust-hir-type-check-expr.cc
index 860975301a0e..4b78ef32c9b3 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-expr.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-expr.cc
@@ -1576,7 +1576,7 @@ TypeCheckExpr::visit (HIR::ClosureExpr &expr)
TyTy::TupleType *closure_args
= new TyTy::TupleType (implicit_args_id, expr.get_locus (),
parameter_types);
- context->insert_implicit_type (closure_args);
+ context->insert_implicit_type (closure_args->get_ref (), closure_args);
location_t result_type_locus = expr.has_return_type ()
? expr.get_return_type ().get_locus ()
diff --git a/gcc/rust/typecheck/rust-hir-type-check-pattern.cc b/gcc/rust/typecheck/rust-hir-type-check-pattern.cc
index ac43eaafacfa..a00fa7dbd89b 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-pattern.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-pattern.cc
@@ -653,7 +653,8 @@ ClosureParamInfer::Resolve (HIR::Pattern &pattern)
if (resolver.infered->get_kind () != TyTy::TypeKind::ERROR)
{
- resolver.context->insert_implicit_type (resolver.infered);
+ resolver.context->insert_implicit_type (resolver.infered->get_ref (),
+ resolver.infered);
resolver.mappings.insert_location (resolver.infered->get_ref (),
pattern.get_locus ());
}
diff --git a/gcc/rust/typecheck/rust-hir-type-check.h b/gcc/rust/typecheck/rust-hir-type-check.h
index d8742939d95c..18a65fec0483 100644
--- a/gcc/rust/typecheck/rust-hir-type-check.h
+++ b/gcc/rust/typecheck/rust-hir-type-check.h
@@ -171,7 +171,6 @@ public:
void insert_type (const Analysis::NodeMapping &mappings,
TyTy::BaseType *type);
- void insert_implicit_type (TyTy::BaseType *type);
bool lookup_type (HirId id, TyTy::BaseType **type) const;
void clear_type (TyTy::BaseType *ty);
diff --git a/gcc/rust/typecheck/rust-typecheck-context.cc b/gcc/rust/typecheck/rust-typecheck-context.cc
index f6ef2688aaa0..f02e48467317 100644
--- a/gcc/rust/typecheck/rust-typecheck-context.cc
+++ b/gcc/rust/typecheck/rust-typecheck-context.cc
@@ -90,13 +90,6 @@ TypeCheckContext::insert_type (const Analysis::NodeMapping &mappings,
resolved[id] = type;
}
-void
-TypeCheckContext::insert_implicit_type (TyTy::BaseType *type)
-{
- rust_assert (type != nullptr);
- resolved[type->get_ref ()] = type;
-}
-
void
TypeCheckContext::insert_implicit_type (HirId id, TyTy::BaseType *type)
{
More information about the Gcc-cvs
mailing list