This:
fn foo(s: &u8) {
let _ = || &*s;
}
gives the following LLBC:
struct closure<'_0> {
&'_0 u8,
}
fn call_mut<'_0, '_1, '_2>(_1: &'_2 mut closure<'_0>, _2: ()) -> &'_1 u8 {
...
}
_1 and _0 should be the same.
In practice I don't know how to solve this: rustc doesn't seem to encode this information where I expect it; the lifetimes of borrowed upvars are erased.