1 #![feature(type_alias_impl_trait)]
4 struct CopyIfEq<T, U>(T, U);
6 impl<T: Copy> Copy for CopyIfEq<T, T> {}
8 type E<'a, 'b> = impl Sized;
10 fn foo<'a: 'b, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> {
11 let v = CopyIfEq::<*mut _, *mut _>(&mut { x }, &mut y);
13 // This assignment requires that `x` and `y` have the same type due to the
14 // `Copy` impl. The reason why we are using a copy to create a constraint
15 // is that only borrow checking (not regionck in type checking) enforces
18 let _: *mut &'a i32 = u.1;
20 let _: &'b i32 = *u.0;
23 //~^ ERROR hidden type for `impl Trait` captures lifetime that does not appear in bounds