]> git.lizzy.rs Git - rust.git/blob - tests/ui/closures/2229_closure_analysis/diagnostics/closure-origin-multi-variant-diagnostics.rs
Auto merge of #106227 - bryangarza:ctfe-limit, r=oli-obk
[rust.git] / tests / ui / closures / 2229_closure_analysis / diagnostics / closure-origin-multi-variant-diagnostics.rs
1 // edition:2021
2
3 // Check that precise paths are being reported back in the error message.
4
5 enum MultiVariant {
6     Point(i32, i32),
7     Meta(i32)
8 }
9
10 fn main() {
11     let mut point = MultiVariant::Point(10, -10,);
12
13     let mut meta = MultiVariant::Meta(1);
14
15     let c = || {
16         if let MultiVariant::Point(ref mut x, _) = point {
17             *x += 1;
18         }
19
20         if let MultiVariant::Meta(ref mut v) = meta {
21             *v += 1;
22         }
23     };
24
25     let a = c;
26     let b = c; //~ ERROR use of moved value: `c` [E0382]
27 }