Writing some tests to diagnose closure conversion without external functions, I modified the sample from: #177 and found the LLVM codegen fails to emit the function part (it declares it, but never defines it), leading to an invalid module. Whoops.
fn nop(_: i32) -> () {}
fn capture(a : i32) = @|body : fn(i32) -> ()| {
body(a)
};
#[export]
fn c(i : i32) {
let mut a = capture(i);
fn inner_loop(n : i32) -> () {
if (n <= 0) {
a (nop);
} else {
inner_loop(n - 1);
}
}
inner_loop(1);
}