trait Trait<'a, G> {
fn get(&'a self) -> G;
}
impl<'a> Trait<'a, &'a u8> for u8 {
fn get(&'a self) -> &'a u8 {
self
}
}
fn foo<'a, T: Trait<'a, &'a u8> + 'a>(t: T) {
t.get();
}
results in
| borrowed value does not live long enough
| argument requires that `t` is borrowed for `'a`
I'm having a hard time figuring why calling t.get() is at all going to lead to problems. And I want to be able define a trait with a get where it can possibly return a reference of Self. It's why I am annotating a lifetime on &'a self. But either way, what is that borrow error trying to tell me?