1 // Test that the NLL `relate_tys` code correctly deduces that a
2 // function returning always its first argument can be upcast to one
3 // that returns either first or second argument.
7 type DoubleCell<A> = Cell<(A, A)>;
8 type DoublePair<A> = (A, A);
10 fn make_cell<'b>(x: &'b u32) -> Cell<(&'static u32, &'b u32)> {
15 let a: &'static u32 = &22;
18 // Here we get an error because `DoubleCell<_>` requires the same type
19 // on both parts of the `Cell`, and we can't have that.
20 let x: DoubleCell<_> = make_cell(&b); //~ ERROR
22 // Here we do not get an error because `DoublePair<_>` permits
23 // variance on the lifetimes involved.
24 let y: DoublePair<_> = make_cell(&b).get();