3 ms·
Thank you. > It's possible to have an example where 'c must be shorter lived, and cannot outlive the struct. I'm interested in such an example. Could you pro
by groovy2shoes 11y ago
Thank you.
> It's possible to have an example where 'c must be shorter lived, and cannot outlive the struct.
I'm interested in such an example. Could you provide one?
- Manishearth 11y agoActually, I just looked into it, that's no longer possible. I was talking about contravariant lifetime positions, which happen with functions, but now it seems like function pointers are invariant in those positions, not contravariant. The idea was to have something like struct Foo<'a> {f: fn(&'a u8)} should only be able to accept pointers that live shorter than the struct. But contravariance seems to have been removed.
- groovy2shoes 11y agoMakes sense. I can see how having contravariant function arguments could produce some surprising behavior.