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 error[E0506]: cannot assign to `factorial` because it is borrowed
16 --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:30:5
18 LL | let f = |x: u32| -> u32 {
19 | --------------- borrow of `factorial` occurs here
20 LL | let g = factorial.as_ref().unwrap();
21 | --------- borrow occurs due to use in closure
23 LL | factorial = Some(Box::new(f));
26 | assignment to borrowed `factorial` occurs here
27 | borrow later used here
29 error[E0597]: `factorial` does not live long enough
30 --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:38:17
32 LL | let f = |x: u32| -> u32 {
33 | --------------- value captured here
34 LL | //~^ ERROR closure may outlive the current function, but it borrows `factorial`
35 LL | let g = factorial.as_ref().unwrap();
36 | ^^^^^^^^^ borrowed value does not live long enough
39 | - `factorial` dropped here while still borrowed
41 = note: borrowed value must be valid for the static lifetime...
43 error[E0506]: cannot assign to `factorial` because it is borrowed
44 --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:42:5
46 LL | let f = |x: u32| -> u32 {
47 | --------------- borrow of `factorial` occurs here
48 LL | //~^ ERROR closure may outlive the current function, but it borrows `factorial`
49 LL | let g = factorial.as_ref().unwrap();
50 | --------- borrow occurs due to use in closure
52 LL | factorial = Some(Box::new(f));
53 | ^^^^^^^^^ assignment to borrowed `factorial` occurs here
55 = note: borrowed value must be valid for the static lifetime...
57 error: aborting due to 4 previous errors
59 Some errors occurred: E0506, E0597.
60 For more information about an error, try `rustc --explain E0506`.