aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Avery <powerboat9.gamer@gmail.com>2023-10-11 15:02:38 -0400
committerCohenArthur <arthur.cohen@embecosm.com>2023-10-20 12:23:55 +0000
commit2ef9814c6e27a2860951151e09f2c6230379970f (patch)
tree4218b0a468777c7992513abeba5b2924db4c731d
parent9a53cb5c38365773ae22590efb89bdd7f0480f4c (diff)
downloadgcc-2ef9814c6e27a2860951151e09f2c6230379970f.zip
gcc-2ef9814c6e27a2860951151e09f2c6230379970f.tar.gz
gcc-2ef9814c6e27a2860951151e09f2c6230379970f.tar.bz2
Make lowering of AssociatedItem instances polymorphic
gcc/rust/ChangeLog: * hir/rust-ast-lower-implitem.h (ASTLoweringImplItem::translate): Take AssociatedItem as parameter. (ASTLoweringTraitItem::translate): Likewise. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
-rw-r--r--gcc/rust/hir/rust-ast-lower-implitem.h28
1 files changed, 2 insertions, 26 deletions
diff --git a/gcc/rust/hir/rust-ast-lower-implitem.h b/gcc/rust/hir/rust-ast-lower-implitem.h
index c8f6440..abb0227 100644
--- a/gcc/rust/hir/rust-ast-lower-implitem.h
+++ b/gcc/rust/hir/rust-ast-lower-implitem.h
@@ -32,31 +32,7 @@ class ASTLowerImplItem : public ASTLoweringBase
using Rust::HIR::ASTLoweringBase::visit;
public:
- static HIR::ImplItem *translate (AST::InherentImplItem *item,
- HirId parent_impl_id)
- {
- ASTLowerImplItem resolver;
- item->accept_vis (resolver);
-
- if (resolver.translated != nullptr)
- {
- rust_assert (resolver.item_cast != nullptr);
-
- auto id = resolver.translated->get_impl_mappings ().get_hirid ();
- auto defid = resolver.translated->get_impl_mappings ().get_defid ();
- auto locus = resolver.translated->get_locus ();
-
- resolver.handle_outer_attributes (*resolver.item_cast);
- resolver.mappings->insert_hir_implitem (parent_impl_id,
- resolver.translated);
- resolver.mappings->insert_location (id, locus);
- resolver.mappings->insert_defid_mapping (defid, resolver.item_cast);
- }
-
- return resolver.translated;
- }
-
- static HIR::ImplItem *translate (AST::TraitImplItem *item,
+ static HIR::ImplItem *translate (AST::AssociatedItem *item,
HirId parent_impl_id)
{
ASTLowerImplItem resolver;
@@ -312,7 +288,7 @@ class ASTLowerTraitItem : public ASTLoweringBase
using Rust::HIR::ASTLoweringBase::visit;
public:
- static HIR::TraitItem *translate (AST::TraitItem *item)
+ static HIR::TraitItem *translate (AST::AssociatedItem *item)
{
ASTLowerTraitItem resolver;
item->accept_vis (resolver);