1 // Check that repeated type variables are correctly handled
4 #![feature(type_ascription)]
6 type PairUncoupled<'a, 'b, T> = (&'a T, &'b T);
7 type PairCoupledTypes<T> = (T, T);
8 type PairCoupledRegions<'a, T> = (&'a T, &'a T);
10 fn uncoupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 {
11 let ((y, _z),) = type_ascribe!(((s, _x),), (PairUncoupled<_>,));
15 fn coupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 {
16 let ((y, _z),) = type_ascribe!(((s, _x),), (PairCoupledTypes<_>,));
17 y //~ ERROR lifetime may not live long enough
20 fn coupled_regions_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 {
21 let ((y, _z),) = type_ascribe!(((s, _x),), (PairCoupledRegions<_>,));
22 y //~ ERROR lifetime may not live long enough
25 fn cast_uncoupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 {
26 let ((y, _z),) = ((s, _x),) as (PairUncoupled<_>,);
30 fn cast_coupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 {
31 let ((y, _z),) = ((s, _x),) as (PairCoupledTypes<_>,);
32 y //~ ERROR lifetime may not live long enough
35 fn cast_coupled_regions_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 {
36 let ((y, _z),) = ((s, _x),) as (PairCoupledRegions<_>,);
37 y //~ ERROR lifetime may not live long enough