summaryrefslogtreecommitdiffstats
path: root/tests/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-4.stderr
blob: d47f0539b84b2f5415b7bb7a340fb35dfbd1a53b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
error[E0373]: closure may outlive the current function, but it borrows `p`, which is owned by the current function
  --> $DIR/borrowck-4.rs:10:17
   |
LL |     let mut c = || {
   |                 ^^ may outlive borrowed value `p`
...
LL |        println!("{:?}", p);
   |                         - `p` is borrowed here
   |
note: closure is returned here
  --> $DIR/borrowck-4.rs:15:5
   |
LL |     c
   |     ^
help: to force the closure to take ownership of `p` (and any other referenced variables), use the `move` keyword
   |
LL |     let mut c = move || {
   |                 ++++

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0373`.