Contravariant lifetimes can model garbage collected handles in Rust more accurately than covariant ones. Unlike normal references where longer lifetimes can substitute for shorter ones, contravariant references reverse this relationship, allowing handles with shorter lifetimes to be stored in places expecting longer lifetimes.
Sort: