In Rust, you can pass a &'static str
to a function that accepts a & 'a str
.
The result is that we treat 'b
as a subtype of 'a
if 'b
outlives 'a
. And in Rust, generic lifetime in function parameters are contravariant, and generic lifetime in function return types are covariant.