fork/rust
git clone https://git.julia.blue/fork/rust
4560ea788cb
1.39.0
1error[E0597]: `factorial` does not live long enough 2 --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:15:17 3 | 4LL | let f = |x: u32| -> u32 { 5 | --------------- value captured here 6LL | let g = factorial.as_ref().unwrap(); 7 | ^^^^^^^^^ borrowed value does not live long enough 8... 9LL | } 10 | - 11 | | 12 | `factorial` dropped here while still borrowed 13 | borrow might be used here, when `factorial` is dropped and runs the destructor for type `std::option::Option<std::boxed::Box<dyn std::ops::Fn(u32) -> u32>>` 14 15error[E0506]: cannot assign to `factorial` because it is borrowed 16 --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:20:5 17 | 18LL | let f = |x: u32| -> u32 { 19 | --------------- borrow of `factorial` occurs here 20LL | let g = factorial.as_ref().unwrap(); 21 | --------- borrow occurs due to use in closure 22... 23LL | factorial = Some(Box::new(f)); 24 | ^^^^^^^^^ 25 | | 26 | assignment to borrowed `factorial` occurs here 27 | borrow later used here 28 29error[E0597]: `factorial` does not live long enough 30 --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:28:17 31 | 32LL | let f = |x: u32| -> u32 { 33 | --------------- value captured here 34LL | let g = factorial.as_ref().unwrap(); 35 | ^^^^^^^^^ borrowed value does not live long enough 36... 37LL | } 38 | - 39 | | 40 | `factorial` dropped here while still borrowed 41 | borrow might be used here, when `factorial` is dropped and runs the destructor for type `std::option::Option<std::boxed::Box<dyn std::ops::Fn(u32) -> u32>>` 42 43error[E0506]: cannot assign to `factorial` because it is borrowed 44 --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:33:5 45 | 46LL | let f = |x: u32| -> u32 { 47 | --------------- borrow of `factorial` occurs here 48LL | let g = factorial.as_ref().unwrap(); 49 | --------- borrow occurs due to use in closure 50... 51LL | factorial = Some(Box::new(f)); 52 | ^^^^^^^^^ 53 | | 54 | assignment to borrowed `factorial` occurs here 55 | borrow later used here 56 57error: aborting due to 4 previous errors 58 59Some errors have detailed explanations: E0506, E0597. 60For more information about an error, try `rustc --explain E0506`.