aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile.cc
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-01-24 18:38:58 +0000
committerPhilip Herron <philip.herron@embecosm.com>2022-01-24 18:42:24 +0000
commitc8a0c6eb4b9ea3779f01418cfc97a6761ca4a957 (patch)
tree5c10c91f085cbe16316fd5dff0a611bbd40a0610 /gcc/rust/backend/rust-compile.cc
parent3de87e620f8714278c273ec91dc6ec22347c188c (diff)
downloadgcc-c8a0c6eb4b9ea3779f01418cfc97a6761ca4a957.zip
gcc-c8a0c6eb4b9ea3779f01418cfc97a6761ca4a957.tar.gz
gcc-c8a0c6eb4b9ea3779f01418cfc97a6761ca4a957.tar.bz2
Remove hack to handle forward declared items
We used to use a compile_fns flag as a method to handle the case of code such as: ```rust fn foo() { bar() } fn bar() { } ``` The compile_fns flag when set to false would allow us to do a toplevel scan to compile the initial fndecl prototype of the functions as a method of handling the case of the call to bar() within the body of foo. The backend is setup now that we can 'query_compile' by compiling the item as required with a cache if we have already done so.
Diffstat (limited to 'gcc/rust/backend/rust-compile.cc')
-rw-r--r--gcc/rust/backend/rust-compile.cc9
1 files changed, 3 insertions, 6 deletions
diff --git a/gcc/rust/backend/rust-compile.cc b/gcc/rust/backend/rust-compile.cc
index dcf698a..b0447af 100644
--- a/gcc/rust/backend/rust-compile.cc
+++ b/gcc/rust/backend/rust-compile.cc
@@ -46,10 +46,7 @@ void
CompileCrate::go ()
{
for (auto &item : crate.items)
- CompileItem::compile (item.get (), ctx, false);
-
- for (auto &item : crate.items)
- CompileItem::compile (item.get (), ctx, true);
+ CompileItem::compile (item.get (), ctx);
}
// rust-compile-block.h
@@ -274,7 +271,7 @@ HIRCompileBase::compile_locals_for_block (Resolver::Rib &rib, tree fndecl,
if (is_item)
{
HIR::Item *item = static_cast<HIR::Item *> (decl);
- CompileItem::compile (item, ctx, true);
+ CompileItem::compile (item, ctx);
return true;
}
@@ -528,7 +525,7 @@ HIRCompileBase::compute_address_for_trait_item (
lookup_fntype = lookup_fntype->handle_substitions (mappings);
}
- return CompileInherentImplItem::Compile (associated_function, ctx, true,
+ return CompileInherentImplItem::Compile (associated_function, ctx,
lookup_fntype, true, locus);
}