summary refs log tree commit diff
path: root/src/test/compile-fail/block-coerce-no.rs
blob: 42c893a2064216d0c80f255138bf7089db2abd06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Make sure that fn-to-block coercion isn't incorrectly lifted over
// other tycons.

fn coerce(b: fn()) -> native fn() {
    fn lol(f: native fn(block()) -> native fn(),
           g: fn()) -> native fn() { ret f(g); }
    fn fn_id(f: native fn()) -> native fn() { ret f }
    ret lol(fn_id, b);
    //!^ ERROR mismatched types: expected `native fn(fn&()) -> native fn()`
}

fn main() {
    let i = 8;
    let f = coerce({|| log(error, i); });
    f();
}