summary refs log tree commit diff
path: root/src/test/ui/issues/issue-4335.stderr
blob: ca1c0b68d2a5f295e6d933cd0144b73966a64ddb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
error[E0507]: cannot move out of `*v`, as `v` is a captured variable in an `FnMut` closure
  --> $DIR/issue-4335.rs:6:20
   |
LL | fn f<'r, T>(v: &'r T) -> Box<dyn FnMut() -> T + 'r> {
   |             - captured outer variable
LL |     id(Box::new(|| *v))
   |                    ^^ move occurs because `*v` has type `T`, which does not implement the `Copy` trait

error[E0373]: closure may outlive the current function, but it borrows `v`, which is owned by the current function
  --> $DIR/issue-4335.rs:6:17
   |
LL |     id(Box::new(|| *v))
   |                 ^^  - `v` is borrowed here
   |                 |
   |                 may outlive borrowed value `v`
   |
note: closure is returned here
  --> $DIR/issue-4335.rs:6:5
   |
LL |     id(Box::new(|| *v))
   |     ^^^^^^^^^^^^^^^^^^^
help: to force the closure to take ownership of `v` (and any other referenced variables), use the `move` keyword
   |
LL |     id(Box::new(move || *v))
   |                 ^^^^^^^

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0373, E0507.
For more information about an error, try `rustc --explain E0373`.