fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1error[E0521]: borrowed data escapes outside of function 2 --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:5 3 | 4LL | fn foo(x: &()) { 5 | - - let's call the lifetime of this reference `'1` 6 | | 7 | `x` is a reference that is only valid in the function body 8LL | / bar(|| { 9LL | | 10LL | | 11LL | | let _ = x; 12LL | | }) 13 | | ^ 14 | | | 15 | |______`x` escapes the function body here 16 | argument requires that `'1` must outlive `'static` 17 18error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function 19 --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:9 20 | 21LL | bar(|| { 22 | ^^ may outlive borrowed value `x` 23... 24LL | let _ = x; 25 | - `x` is borrowed here 26 | 27note: function requires argument type to outlive `'static` 28 --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:5 29 | 30LL | / bar(|| { 31LL | | 32LL | | 33LL | | let _ = x; 34LL | | }) 35 | |______^ 36help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword 37 | 38LL | bar(move || { 39 | ++++ 40 41error: aborting due to 2 previous errors 42 43Some errors have detailed explanations: E0373, E0521. 44For more information about an error, try `rustc --explain E0373`.