For any `'a`, use of `&'a T` => `T: 'a`

This is a question about the situation where we have a generic type behind a reference. Should it be the case that the compiler infers that the type must live at least as long as the reference, so the existence of &'a T means that the constraint T: 'a is implied?

It does already. See also RFC 2093 (implemented and stabilized).

1 Like

Hmm reading this now I'm not sure what I was getting at originally. I think I was finding that in a fairly complex type I was finding this lifetime not inferred. I will see if I can find the original type signature.