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

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

28 lines
532 B
Rust
Raw Normal View History

2021-06-27 01:22:46 -05:00
// edition:2021
// Check that precise paths are being reported back in the error message.
enum MultiVariant {
Point(i32, i32),
Meta(i32)
}
fn main() {
let mut point = MultiVariant::Point(10, -10,);
let mut meta = MultiVariant::Meta(1);
let c = || {
if let MultiVariant::Point(ref mut x, _) = point {
*x += 1;
}
if let MultiVariant::Meta(ref mut v) = meta {
*v += 1;
}
};
let a = c;
let b = c; //~ ERROR use of moved value: `c` [E0382]
}