它的lifetime 'b肯定短于do_sth的lifetime, 即'a : 'b, 所以矛盾, reject。
Adding arguments or a return to the closure Using or calling the closure (calling the closure adds another error on the call expression) Replacing the closure with an async block Things that don't exhibit the issue: A HRTB with a trait generic over a lifetime:T: for<'a> Trait<'a>orf...
实践中主要是后者,比如某个函数接受一个函数参数Fn(&mut i32),函数内可以创建一个mut i32类型的a,...
error[E0106]: missing lifetime specifier --> src/main.rs:12:36 | 12 | fn bar() -...
error[E0106]: missing lifetime specifier --> src/main.rs:12:36 | 12 | fn bar() -...
'1 'inner '2 做不到用一个生存期参数表示 b 需要满足上述3个不同的生存期 fn foo<'a>(b: ...
function foo<T>(t: [T]): int { return t.length } foo是一个函数,函数是一个值,那么...