summaryrefslogtreecommitdiffstats
path: root/src/test/ui/chalkify/closure.rs
blob: 81114d491d78ebaab04bb300b65ef4cda22f0784 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// check-fail
// compile-flags: -Z chalk

fn main() -> () {
    let t = || {};
    t();

    let mut a = 0;
    let mut b = move || {
        a = 1;
    };
    b();

    let mut c = b;

    c();
    b();

    let mut a = 0;
    let mut b = || {
        a = 1;
    };
    b();

    let mut c = b;

    c();
    b(); //~ ERROR

    // FIXME(chalk): this doesn't quite work
    /*
    let b = |c| {
        c
    };

    let a = &32;
    b(a);
    */
}