summaryrefslogtreecommitdiffstats
path: root/tests/ui/closures/2229_closure_analysis/diagnostics/closure-origin-single-variant-diagnostics.rs
blob: bedb103cc4c7bd5da4c06aeb8ac528ace3138010 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// edition:2021


enum SingleVariant {
    Point(i32, i32),
}

fn main() {
    let mut point = SingleVariant::Point(10, -10);

    let c = || {
        let SingleVariant::Point(ref mut x, _) = point;
        *x += 1;
    };

    let b = c;
    let a = c; //~ ERROR use of moved value: `c` [E0382]
}