From a9f405988052a49ad3ebbe2a5b1f0db80036b2cd Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 11 Nov 2018 01:51:57 +0100 Subject: main(): Give the FastCGI closure access to the DB connection pool Otherwise we get a borrow error: error[E0373]: closure may outlive the current function, but it borrows `pool`, which is owned by the current function --> src/main.rs:67:18 | 67 | fastcgi::run(|mut req| { | ^^^^^^^^^ may outlive borrowed value `pool` ... 123 | let mut cx = match pool.get_conn() { | ---- `pool` is borrowed here help: to force the closure to take ownership of `pool` (and any other referenced variables), use the `move` keyword | 67 | fastcgi::run(move |mut req| { | ^^^^^^^^^^^^^^ --- license-generator/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'license-generator/src') diff --git a/license-generator/src/main.rs b/license-generator/src/main.rs index fb29824..8e60d51 100644 --- a/license-generator/src/main.rs +++ b/license-generator/src/main.rs @@ -64,7 +64,7 @@ fn main() -> Result<()> { }, }; - fastcgi::run(|mut req| { + fastcgi::run(move |mut req| { let mut params = String::new(); match req.stdin().read_to_string(&mut params) { Ok(_) => (), -- cgit v1.2.3