lifetime-generate issue: named lifetime param on closure
tjhance opened this issue · comments
Travis Hance commented
Reported by Yi Cai:
use vstd::prelude::*;
verus! {
pub struct S<'a> {
pub data: &'a u8,
}
type Res<'a, T> = Result<(S<'a>, T), Err>;
pub enum Err {
A,
}
fn not_ok<'a>(s: S<'a>) -> Res<'a, u8> {
let cls = |s: S<'a>| -> Res<'a, u8> { ok(s) };
Ok((s, 0))
}
fn ok<'a>(s: S<'a>) -> Res<'a, u8> {
Ok((s, 0))
}
fn main();
}
error: lifetime may not live long enough
--> /playground/src/main.rs:16:16
|
16 | let cls = |s: S<'a>| -> Res<'a, u8> { ok(s) };
| ^ ^ ^^^^^
error: aborting due to previous error
note: This error was found in Verus pass: ownership checking of tracked code
error: aborting due to 2 previous errors