1 error[E0597]: `factorial` does not live long enough
2 --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:25:17
4 LL | let f = |x: u32| -> u32 {
5 | --------------- value captured here
6 LL | let g = factorial.as_ref().unwrap();
7 | ^^^^^^^^^ borrowed value does not live long enough
12 | `factorial` dropped here while still borrowed
13 | borrow later used here, when `factorial` is dropped
15 = note: values in a scope are dropped in the opposite order they are defined
17 error[E0506]: cannot assign to `factorial` because it is borrowed
18 --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:30:5
20 LL | let f = |x: u32| -> u32 {
21 | --------------- borrow of `factorial` occurs here
22 LL | let g = factorial.as_ref().unwrap();
23 | --------- borrow occurs due to use in closure
25 LL | factorial = Some(Box::new(f));
28 | assignment to borrowed `factorial` occurs here
29 | borrow later used here
31 error[E0597]: `factorial` does not live long enough
32 --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:38:17
34 LL | let f = |x: u32| -> u32 {
35 | --------------- value captured here
36 LL | //~^ ERROR closure may outlive the current function, but it borrows `factorial`
37 LL | let g = factorial.as_ref().unwrap();
38 | ^^^^^^^^^ borrowed value does not live long enough
41 | - `factorial` dropped here while still borrowed
43 = note: borrowed value must be valid for the static lifetime...
45 error[E0506]: cannot assign to `factorial` because it is borrowed
46 --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:42:5
48 LL | let f = |x: u32| -> u32 {
49 | --------------- borrow of `factorial` occurs here
50 LL | //~^ ERROR closure may outlive the current function, but it borrows `factorial`
51 LL | let g = factorial.as_ref().unwrap();
52 | --------- borrow occurs due to use in closure
54 LL | factorial = Some(Box::new(f));
55 | ^^^^^^^^^ assignment to borrowed `factorial` occurs here
57 = note: borrowed value must be valid for the static lifetime...
59 error: aborting due to 4 previous errors
61 Some errors occurred: E0506, E0597.
62 For more information about an error, try `rustc --explain E0506`.