Given this code:
struct RefWrapper<\'a, T> {
r: &\'a T,
}
... the compiler complains:
error: the param
Congratulations, you were right! As of Rust 1.31, thanks to RFC 2093, Infer T: 'x outlives requirements on structs, the requirement on the user to type out this restriction has been removed:
Remove the need for explicit
T: 'xannotations on structs. We will infer their presence based on the fields of the struct. In short, if the struct contains a reference, directly or indirectly, toTwith lifetime'x, then we will infer thatT: 'xis a requirement
Basically, there wasn't a case where this wasn't required, so there wasn't much value in forcing the programmer to write it out.