pub fn understand_lifetime_for_closure()
Expand description
§闭包 与 高阶生命周期
fn main() {
let f = |x: &i32| x; // error
// 假如支持下面的语法就方便多了,目前还未支持
// let f: for<'a> Fn(&'a i32) -> &'a i32 = |x| x;
let i = &3;
let j = f(i);
}
修正:
pub fn understand_lifetime_for_closure()
fn main() {
let f = |x: &i32| x; // error
// 假如支持下面的语法就方便多了,目前还未支持
// let f: for<'a> Fn(&'a i32) -> &'a i32 = |x| x;
let i = &3;
let j = f(i);
}
修正: