3 // Get<T> is covariant in T
8 struct Cloner<T:Clone> {
12 impl<T:Clone> Get<T> for Cloner<T> {
18 fn get<'a, G>(get: &G) -> i32
19 where G : Get<&'a i32>
21 // This fails to type-check because, without variance, we can't
22 // use `G : Get<&'a i32>` as evidence that `G : Get<&'b i32>`,
24 pick(get, &22) //~ ERROR explicit lifetime required in the type of `get` [E0621]
27 fn pick<'b, G>(get: &'b G, if_odd: &'b i32) -> i32
28 where G : Get<&'b i32>
31 if v % 2 != 0 { v } else { *if_odd }
35 let x = Cloner { t: &23 };