aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorGS-GOAT <86884129+GS-GOAT@users.noreply.github.com>2025-02-08 12:03:18 +0530
committerGS-GOAT <86884129+GS-GOAT@users.noreply.github.com>2025-02-08 12:52:57 +0530
commitaf234dd6a9dcb71498d16a8fb65ad53bc5d62ef4 (patch)
tree651098b20442aa6fe84b4b9f4214dcbf1ea25e03 /gcc
parent7691105e19b0437c83d104f53ec34f8279b79c84 (diff)
downloadgcc-af234dd6a9dcb71498d16a8fb65ad53bc5d62ef4.zip
gcc-af234dd6a9dcb71498d16a8fb65ad53bc5d62ef4.tar.gz
gcc-af234dd6a9dcb71498d16a8fb65ad53bc5d62ef4.tar.bz2
Get rid of duplicate interface #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>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/typecheck/rust-autoderef.cc2
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check-expr.cc2
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check-pattern.cc3
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check.h1
-rw-r--r--gcc/rust/typecheck/rust-typecheck-context.cc7
5 files changed, 4 insertions, 11 deletions
diff --git a/gcc/rust/typecheck/rust-autoderef.cc b/gcc/rust/typecheck/rust-autoderef.cc
index a0a2b50..f4dfa66 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 2fb4d3c..2d9ec83 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 765504f..bc816fd 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 21ecf2c..65f38c6 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 4cee74a..907833f 100644
--- a/gcc/rust/typecheck/rust-typecheck-context.cc
+++ b/gcc/rust/typecheck/rust-typecheck-context.cc
@@ -91,13 +91,6 @@ TypeCheckContext::insert_type (const Analysis::NodeMapping &mappings,
}
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)
{
rust_assert (type != nullptr);