about summary refs log tree commit diff
path: root/src/allocator.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/allocator.rs')
-rw-r--r--src/allocator.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/allocator.rs b/src/allocator.rs
index b3b2b53444d..d4a1f1a49fa 100644
--- a/src/allocator.rs
+++ b/src/allocator.rs
@@ -73,10 +73,8 @@ pub fn codegen_inner(module: &mut Module<impl Backend + 'static>, kind: Allocato
             .unwrap();
 
         let mut ctx = Context::new();
-        ctx.func = Function::with_name_signature(ExternalName::user(0, 0), sig.clone());
-        {
-            let mut func_ctx = FunctionBuilderContext::new();
-            let mut bcx = FunctionBuilder::new(&mut ctx.func, &mut func_ctx);
+        ctx.func = {
+            let mut bcx = FunctionBuilder::new(Function::with_name_signature(ExternalName::user(0, 0), sig.clone()));
 
             let ebb = bcx.create_ebb();
             bcx.switch_to_block(ebb);
@@ -92,8 +90,9 @@ pub fn codegen_inner(module: &mut Module<impl Backend + 'static>, kind: Allocato
             let results = bcx.inst_results(call_inst).to_vec(); // Clone to prevent borrow error
             bcx.ins().return_(&results);
             bcx.seal_all_blocks();
-            bcx.finalize();
-        }
+            bcx.finalize()
+        };
+
         module.define_function(func_id, &mut ctx).unwrap();
     }
 }