about summary refs log tree commit diff
path: root/tests/ui/foreign/foreign-safe-fn-arg-mismatch.rs
blob: bb1052b15e9d11e19675ccabffff16b3a14398ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// Make sure we don't ICE when a foreign fn doesn't implement `Fn` due to arg mismatch.

unsafe extern "Rust" {
    pub safe fn foo();
    pub safe fn bar(x: u32);
}

fn test(_: impl Fn(i32)) {}

fn main() {
    test(foo); //~ ERROR function is expected to take 1 argument, but it takes 0 arguments
    test(bar); //~ ERROR type mismatch in function arguments
}