about summary refs log tree commit diff
path: root/tests/mir-opt/issue_120925_unsafefncast.rs
blob: f80ae66efdae3b3ffabbaa85f1d68333b82ad871 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Verify that we do not ICE when attempting to interpret casts between fn types.
// skip-filecheck

static FOO: fn() = || assert_ne!(42, 43);
static BAR: fn(i32, i32) = |a, b| assert_ne!(a, b);

fn main() {
    FOO();

    let bar: unsafe fn(i32, i32) = BAR;

    let f: fn() = || {};
    f();

    f();

    f();

    let g: fn(i32) = |i| assert_eq!(i, 2);
    g(2);

    g(2);

    g(2);
}