Cannot call a function in a spawned thread because it “does not fulfill the required lifetime”
问题 I can run this code fn testf(host: &str) {} fn start(host: &str) { testf(host); testf(host); } but for some reason, I can't run this one: fn testf(host: &str) {} fn start(host: &str) { thread::spawn(move || testf(host)); thread::spawn(move || testf(host)); } because of the following error src/server.rs:30:5: 30:18 error: the type `[closure@src/server.rs:30:19: 30:38 host:&str]` does not fulfill the required lifetime src/server.rs:30 thread::spawn(move || testf(host)); ^~~~~~~~~~~~~ note: type