From 77e36125812c257c68a89d56e6dad30e6c081ebe Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Thu, 13 Dec 2018 15:08:11 +0100 Subject: [PATCH] Move emit_module a bit up --- src/lib.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index bb7ff63b0a6..c7b328b5d88 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -237,13 +237,6 @@ impl CodegenBackend for CraneliftCodegenBackend { module }; - let mut faerie_module = new_module("some_file".to_string()); - - codegen_cgus(tcx, &mut faerie_module, &mut log); - crate::allocator::codegen(tcx.sess, &mut faerie_module); - - tcx.sess.abort_if_errors(); - let emit_module = |name: &str, kind: ModuleKind, mut module: Module| { module.finalize_definitions(); let artifact = module.finish().artifact; @@ -262,6 +255,13 @@ impl CodegenBackend for CraneliftCodegenBackend { } }; + let mut faerie_module = new_module("some_file".to_string()); + + codegen_cgus(tcx, &mut faerie_module, &mut log); + crate::allocator::codegen(tcx.sess, &mut faerie_module); + + tcx.sess.abort_if_errors(); + return Box::new(CodegenResults { crate_name: tcx.crate_name(LOCAL_CRATE), modules: vec![emit_module("dummy_name", ModuleKind::Regular, faerie_module)],