summary refs log tree commit diff
path: root/src/test/compile-fail/cap-clause-with-stack-closure.rs
blob: fbfbfb198ccbaf9580dde8525da4e87f952b5968 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
fn foo(_f: fn()) {}
fn bar(_f: @int) {}

fn main() {
    let x = @3;
    foo(|| bar(x) );

    let x = @3;
    foo(|copy x| bar(x) ); //~ ERROR cannot capture values explicitly with a block closure

    let x = @3;
    foo(|move x| bar(x) ); //~ ERROR cannot capture values explicitly with a block closure
}