]> git.proxmox.com Git - rustc.git/blob - tests/ui/borrowck/issue-83760.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / borrowck / issue-83760.rs
1 struct Struct;
2
3 fn test1() {
4 let mut val = Some(Struct);
5 while let Some(foo) = val { //~ ERROR use of moved value
6 if true {
7 val = None;
8 } else {
9
10 }
11 }
12 }
13
14 fn test2() {
15 let mut foo = Some(Struct);
16 let _x = foo.unwrap();
17 if true {
18 foo = Some(Struct);
19 } else {
20 }
21 let _y = foo; //~ ERROR use of moved value: `foo`
22 }
23
24 fn test3() {
25 let mut foo = Some(Struct);
26 let _x = foo.unwrap();
27 if true {
28 foo = Some(Struct);
29 } else if true {
30 foo = Some(Struct);
31 } else if true {
32 foo = Some(Struct);
33 } else if true {
34 foo = Some(Struct);
35 } else {
36 }
37 let _y = foo; //~ ERROR use of moved value: `foo`
38 }
39
40 fn main() {}