]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Get rid of duplicate interface gccrs#3396
authorGS-GOAT <86884129+GS-GOAT@users.noreply.github.com>
Sat, 8 Feb 2025 06:33:18 +0000 (12:03 +0530)
committerArthur Cohen <arthur.cohen@embecosm.com>
Mon, 24 Mar 2025 12:07:04 +0000 (13:07 +0100)
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>
gcc/rust/typecheck/rust-autoderef.cc
gcc/rust/typecheck/rust-hir-type-check-expr.cc
gcc/rust/typecheck/rust-hir-type-check-pattern.cc
gcc/rust/typecheck/rust-hir-type-check.h
gcc/rust/typecheck/rust-typecheck-context.cc

index 75da3919ea4b5bce90f65cbcd6cf1fedf50c4675..6aa20a8c941415c1635f8e04b14a21e943159bc7 100644 (file)
@@ -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);
 }
index 860975301a0ec83bef3a444b93c15e825ba60561..4b78ef32c9b3cf46d5a4e8781cbf723e6c906385 100644 (file)
@@ -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 ()
index ac43eaafacfade242fc8fc8589dc8ccfe9f7aa45..a00fa7dbd89bdb0aa58c11e735842f2c0b25445d 100644 (file)
@@ -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 ());
     }
index d8742939d95c68d9b59e4bfc55d6d8853783ed99..18a65fec0483d3c0a79ca6f5d76f9e891554bd7e 100644 (file)
@@ -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);
 
index f6ef2688aaa0fb5847cc7d306cda65e9d25ab405..f02e48467317227fcbe2ebb2b179c690356af3c0 100644 (file)
@@ -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)
 {