about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSimonas Kazlauskas <git@kazlauskas.me>2015-02-27 14:18:39 +0200
committerSimonas Kazlauskas <git@kazlauskas.me>2015-04-03 15:46:09 +0300
commitbaa52caf83ef82c301e1264f370de5c22fc3c48d (patch)
tree06eed3ffd776e8ef6b50b11a392ef9bafb35ce16
parent2198969f89e0b646794bb4259cefacf50d98fc16 (diff)
downloadrust-baa52caf83ef82c301e1264f370de5c22fc3c48d.tar.gz
rust-baa52caf83ef82c301e1264f370de5c22fc3c48d.zip
Abort creating wrapper fn for multiple inner fns
This discovers another class of mis-trans where we wrap multiple native functions into a single
wrapper, which is wrong.
-rw-r--r--src/librustc_trans/trans/foreign.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/librustc_trans/trans/foreign.rs b/src/librustc_trans/trans/foreign.rs
index e87a5865df0..e154bc1d579 100644
--- a/src/librustc_trans/trans/foreign.rs
+++ b/src/librustc_trans/trans/foreign.rs
@@ -642,6 +642,11 @@ pub fn trans_rust_fn_with_foreign_abi<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
         //         return r;
         //     }
 
+        if llvm::LLVMCountBasicBlocks(llwrapfn) != 0 {
+            ccx.sess().bug("wrapping a function inside non-empty wrapper, most likely cause is \
+                           multiple functions being wrapped");
+        }
+
         let ptr = "the block\0".as_ptr();
         let the_block = llvm::LLVMAppendBasicBlockInContext(ccx.llcx(), llwrapfn,
                                                             ptr as *const _);