Relative Content

Tag Archive for rustlifetimecovariance

Could Rust lifetime be completely desribed by the type variance system?

From my understanding, variation is a type system construct, based on which the compiler could do much of the intended semantics of the whole lifetime idea just from purely a type system level, as illustrated in the example provided in nomicon: the assign function wants a concrete same type T for its two input arguments, while finding it not possible since &mut T is invariant over T. So far so good.