]> git.lizzy.rs Git - rust.git/blob - tests/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-3.stderr
Rollup merge of #106427 - mejrs:translation_errors, r=davidtwco
[rust.git] / tests / ui / closures / 2229_closure_analysis / diagnostics / borrowck / borrowck-3.stderr
1 error[E0373]: closure may outlive the current block, but it borrows `p`, which is owned by the current block
2   --> $DIR/borrowck-3.rs:11:9
3    |
4 LL |         || {
5    |         ^^ may outlive borrowed value `p`
6 LL |            let x = &mut p.x;
7 LL |            println!("{:?}", p);
8    |                             - `p` is borrowed here
9    |
10 note: block requires argument type to outlive `'1`
11   --> $DIR/borrowck-3.rs:9:9
12    |
13 LL |     let mut c = {
14    |         ^^^^^
15 help: to force the closure to take ownership of `p` (and any other referenced variables), use the `move` keyword
16    |
17 LL |         move || {
18    |         ++++
19
20 error: aborting due to previous error
21
22 For more information about this error, try `rustc --explain E0373`.