Skip to content

LLVM error: Call parameter type does not match function signature #36744

Closed
@C4K3

Description

@C4K3

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.

Metadata

Metadata

Assignees

Labels

P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions