Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get rid of duplicate interface #3396 #3422

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gcc/rust/typecheck/rust-autoderef.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion gcc/rust/typecheck/rust-hir-type-check-expr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down
3 changes: 2 additions & 1 deletion gcc/rust/typecheck/rust-hir-type-check-pattern.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 ());
}
Expand Down
1 change: 0 additions & 1 deletion gcc/rust/typecheck/rust-hir-type-check.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ class TypeCheckContext

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);

Expand Down
7 changes: 0 additions & 7 deletions gcc/rust/typecheck/rust-typecheck-context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Loading