From: GS-GOAT <86884129+gs-g...@users.noreply.github.com>

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 <guransh...@gmail.com>
---
 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 75da3919ea4..6aa20a8c941 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 860975301a0..4b78ef32c9b 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 ac43eaafacf..a00fa7dbd89 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 d8742939d95..18a65fec048 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 f6ef2688aaa..f02e4846731 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)
 {
-- 
2.45.2

Reply via email to