rust/tests/ui/closures/2229_closure_analysis/diagnostics/closure-origin-single-variant-diagnostics.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
299 B
Rust
Raw Normal View History

2021-06-27 01:22:46 -05:00
// edition:2021
enum SingleVariant {
Point(i32, i32),
}
fn main() {
let mut point = SingleVariant::Point(10, -10);
let c = || {
2021-02-02 20:07:52 -06:00
let SingleVariant::Point(ref mut x, _) = point;
*x += 1;
};
let b = c;
let a = c; //~ ERROR use of moved value: `c` [E0382]
}