diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-06-16 13:23:31 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2021-06-16 13:23:31 +0100 |
commit | 730a2174b933162c42843af43d85851b85d64144 (patch) | |
tree | 25b6519e73c5523dbee8a7b1d894ce9c83434913 /gcc/rust/backend | |
parent | 44481c1c2bdf7d160928dde30f48fdc54e75bf38 (diff) | |
download | gcc-730a2174b933162c42843af43d85851b85d64144.zip gcc-730a2174b933162c42843af43d85851b85d64144.tar.gz gcc-730a2174b933162c42843af43d85851b85d64144.tar.bz2 |
Refactor HIR::InherentImpl to become HIR::ImplBlock
This folds the abstract Impl class directly into HIR::ImplBlock since the
TraitImplBlock is removed. It also refactors InherentImplItem to become
simply ImplItem.
Diffstat (limited to 'gcc/rust/backend')
-rw-r--r-- | gcc/rust/backend/rust-compile-base.h | 2 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-implitem.h | 5 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-item.h | 2 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-resolve-path.cc | 5 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile.cc | 5 |
5 files changed, 8 insertions, 11 deletions
diff --git a/gcc/rust/backend/rust-compile-base.h b/gcc/rust/backend/rust-compile-base.h index 29e7562..232d5b9 100644 --- a/gcc/rust/backend/rust-compile-base.h +++ b/gcc/rust/backend/rust-compile-base.h @@ -147,7 +147,7 @@ public: virtual void visit (HIR::TraitItemConst &item) {} virtual void visit (HIR::TraitItemType &item) {} virtual void visit (HIR::Trait &trait) {} - virtual void visit (HIR::InherentImpl &impl) {} + virtual void visit (HIR::ImplBlock &impl) {} virtual void visit (HIR::ExternalStaticItem &item) {} virtual void visit (HIR::ExternalFunctionItem &item) {} diff --git a/gcc/rust/backend/rust-compile-implitem.h b/gcc/rust/backend/rust-compile-implitem.h index a5ca13b..d6698d1 100644 --- a/gcc/rust/backend/rust-compile-implitem.h +++ b/gcc/rust/backend/rust-compile-implitem.h @@ -34,9 +34,8 @@ class CompileInherentImplItem : public HIRCompileBase using Rust::Compile::HIRCompileBase::visit; public: - static void Compile (TyTy::BaseType *self, HIR::InherentImplItem *item, - Context *ctx, bool compile_fns, - TyTy::BaseType *concrete = nullptr) + static void Compile (TyTy::BaseType *self, HIR::ImplItem *item, Context *ctx, + bool compile_fns, TyTy::BaseType *concrete = nullptr) { CompileInherentImplItem compiler (self, ctx, compile_fns, concrete); item->accept_vis (compiler); diff --git a/gcc/rust/backend/rust-compile-item.h b/gcc/rust/backend/rust-compile-item.h index e3b6d0f..8a521e7 100644 --- a/gcc/rust/backend/rust-compile-item.h +++ b/gcc/rust/backend/rust-compile-item.h @@ -274,7 +274,7 @@ public: ctx->push_function (fndecl); } - void visit (HIR::InherentImpl &impl_block) override + void visit (HIR::ImplBlock &impl_block) override { TyTy::BaseType *self_lookup = nullptr; if (!ctx->get_tyctx ()->lookup_type ( diff --git a/gcc/rust/backend/rust-compile-resolve-path.cc b/gcc/rust/backend/rust-compile-resolve-path.cc index 90c4eeb..cb1cfcf 100644 --- a/gcc/rust/backend/rust-compile-resolve-path.cc +++ b/gcc/rust/backend/rust-compile-resolve-path.cc @@ -91,7 +91,7 @@ ResolvePathRef::visit (HIR::PathInExpression &expr) else { HirId parent_impl_id = UNKNOWN_HIRID; - HIR::InherentImplItem *resolved_item + HIR::ImplItem *resolved_item = ctx->get_mappings ()->lookup_hir_implitem ( expr.get_mappings ().get_crate_num (), ref, &parent_impl_id); if (resolved_item != nullptr) @@ -100,8 +100,7 @@ ResolvePathRef::visit (HIR::PathInExpression &expr) HIR::Item *impl_ref = ctx->get_mappings ()->lookup_hir_item ( expr.get_mappings ().get_crate_num (), parent_impl_id); rust_assert (impl_ref != nullptr); - HIR::InherentImpl *impl - = static_cast<HIR::InherentImpl *> (impl_ref); + HIR::ImplBlock *impl = static_cast<HIR::ImplBlock *> (impl_ref); TyTy::BaseType *self = nullptr; bool ok = ctx->get_tyctx ()->lookup_type ( diff --git a/gcc/rust/backend/rust-compile.cc b/gcc/rust/backend/rust-compile.cc index ea21ad3..77036b2 100644 --- a/gcc/rust/backend/rust-compile.cc +++ b/gcc/rust/backend/rust-compile.cc @@ -137,9 +137,8 @@ CompileExpr::visit (HIR::MethodCallExpr &expr) { // this might fail because its a forward decl so we can attempt to // resolve it now - HIR::InherentImplItem *resolved_item - = ctx->get_mappings ()->lookup_hir_implitem ( - expr.get_mappings ().get_crate_num (), ref, nullptr); + HIR::ImplItem *resolved_item = ctx->get_mappings ()->lookup_hir_implitem ( + expr.get_mappings ().get_crate_num (), ref, nullptr); if (resolved_item == nullptr) { rust_error_at (expr.get_locus (), "failed to lookup forward decl"); |