Closed
Description
I get the error
Call parameter type does not match function signature!
%vec = alloca %"3.std::vec::Vec<fn(&B<'_>)>"
%"3.std::vec::Vec<fn(&B)>"* invoke void @_ZN5error4call17h314c247b38f70641E(i8* %15, %"3.std::vec::Vec<fn(&B<'_>)>"* noalias readonly dereferenceable(24) %vec)
to label %normal-return unwind label %unwind_ast_73_, !dbg !407
LLVM ERROR: Broken function found, compilation aborted!
error: Could not compile `error`.
on this code (which I reduced as much as possible while still getting the error)
struct A<'a> {
a: &'a i32,
}
fn call<T>(s: T, functions: &Vec<fn(&T)>) {
for function in functions {
function(&s);
}
}
fn f(a: &A) { }
fn main() {
let a = A { a: &10 };
let vec: Vec<fn(&A)> = vec![f];
call(a, &vec);
}
This is on Rust 1.11.0, on Linux 64.