]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/issue-58776-borrowck-scans-children.stderr
Rollup merge of #106798 - scottmcm:signum-via-cmp, r=Mark-Simulacrum
[rust.git] / tests / ui / borrowck / issue-58776-borrowck-scans-children.stderr
1 error[E0506]: cannot assign to `greeting` because it is borrowed
2   --> $DIR/issue-58776-borrowck-scans-children.rs:5:5
3    |
4 LL |     let res = (|| (|| &greeting)())();
5    |                --      -------- borrow occurs due to use in closure
6    |                |
7    |                `greeting` is borrowed here
8 LL |
9 LL |     greeting = "DEALLOCATED".to_string();
10    |     ^^^^^^^^ `greeting` is assigned to here but it was already borrowed
11 ...
12 LL |     println!("thread result: {:?}", res);
13    |                                     --- borrow later used here
14
15 error[E0505]: cannot move out of `greeting` because it is borrowed
16   --> $DIR/issue-58776-borrowck-scans-children.rs:7:10
17    |
18 LL |     let res = (|| (|| &greeting)())();
19    |                --      -------- borrow occurs due to use in closure
20    |                |
21    |                borrow of `greeting` occurs here
22 ...
23 LL |     drop(greeting);
24    |          ^^^^^^^^ move out of `greeting` occurs here
25 ...
26 LL |     println!("thread result: {:?}", res);
27    |                                     --- borrow later used here
28
29 error: aborting due to 2 previous errors
30
31 Some errors have detailed explanations: E0505, E0506.
32 For more information about an error, try `rustc --explain E0505`.