about summary refs log tree commit diff
path: root/src/test/compile-fail/cap-clause-with-stack-closure.rs
blob: c7192852c378ff85ae5ea891b283c373ab14864d (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
}