]> git.lizzy.rs Git - rust.git/blob - tests/ui/error-codes/E0504.stderr
Rollup merge of #106779 - RReverser:patch-2, r=Mark-Simulacrum
[rust.git] / tests / ui / error-codes / E0504.stderr
1 error[E0505]: cannot move out of `fancy_num` because it is borrowed
2   --> $DIR/E0504.rs:9:13
3    |
4 LL |     let fancy_num = FancyNum { num: 5 };
5    |         --------- binding `fancy_num` declared here
6 LL |     let fancy_ref = &fancy_num;
7    |                     ---------- borrow of `fancy_num` occurs here
8 LL |
9 LL |     let x = move || {
10    |             ^^^^^^^ move out of `fancy_num` occurs here
11 LL |         println!("child function: {}", fancy_num.num);
12    |                                        ------------- move occurs due to use in closure
13 ...
14 LL |     println!("main function: {}", fancy_ref.num);
15    |                                   ------------- borrow later used here
16
17 error: aborting due to previous error
18
19 For more information about this error, try `rustc --explain E0505`.