summaryrefslogtreecommitdiffstats
path: root/src/test/ui/async-await/async-borrowck-escaping-closure-error.stderr
blob: 10691aad04e811c1c63c79de81a6d0b98785e338 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
  --> $DIR/async-borrowck-escaping-closure-error.rs:5:15
   |
LL |     Box::new((async || x)())
   |               ^^^^^^^^ - `x` is borrowed here
   |               |
   |               may outlive borrowed value `x`
   |
note: closure is returned here
  --> $DIR/async-borrowck-escaping-closure-error.rs:5:5
   |
LL |     Box::new((async || x)())
   |     ^^^^^^^^^^^^^^^^^^^^^^^^
help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
   |
LL |     Box::new((async move || x)())
   |                     ++++

error: aborting due to previous error

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