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.
10 type DoubleCell<A> = Cell<(A, A)>;
11 type DoublePair<A> = (A, A);
13 fn make_cell<'b>(x: &'b u32) -> Cell<(&'static u32, &'b u32)> {
18 let a: &'static u32 = &22;
21 // Here we get an error because `DoubleCell<_>` requires the same type
22 // on both parts of the `Cell`, and we can't have that.
23 let x: DoubleCell<_> = make_cell(&b); //~ ERROR
25 // Here we do not get an error because `DoublePair<_>` permits
26 // variance on the lifetimes involved.
27 let y: DoublePair<_> = make_cell(&b).get();