4 #![feature(async_await)]
5 #![feature(existential_type)]
6 #![feature(impl_trait_in_bindings)]
7 //~^ WARNING the feature `impl_trait_in_bindings` is incomplete
11 /////////////////////////////////////////////
12 // Reduction to `impl Trait`
16 trait FooLike { type Output; }
18 impl<T> FooLike for Foo<T> {
29 /// `T::Assoc` should be normalized to `()` here.
30 fn foo_pass<T: Trait<Assoc=()>>() -> impl FooLike<Output=T::Assoc> {
35 /////////////////////////////////////////////
36 // Same with lifetimes in the trait
47 /// FIXME(#51525) -- the shorter notation `T::Assoc` winds up referencing `'static` here
48 fn foo2_pass<'a, T: Trait<'a, Assoc=()> + 'a>(
49 ) -> impl FooLike<Output=<T as Trait<'a>>::Assoc> + 'a {
53 /// Normalization to type containing bound region.
55 /// FIXME(#51525) -- the shorter notation `T::Assoc` winds up referencing `'static` here
56 fn foo2_pass2<'a, T: Trait<'a, Assoc=&'a ()> + 'a>(
57 ) -> impl FooLike<Output=<T as Trait<'a>>::Assoc> + 'a {
62 /////////////////////////////////////////////
63 // Reduction using `impl Trait` in bindings
65 mod impl_trait_in_bindings {
68 trait FooLike { type Output; }
70 impl FooLike for Foo {
78 fn foo<T: Trait<Assoc=u32>>() {
79 let _: impl FooLike<Output=T::Assoc> = Foo;
83 /////////////////////////////////////////////
84 // The same applied to `existential type`s
86 mod existential_types {
90 impl<T> Implemented for T {
102 existential type Ex: Trait<Out = <() as Implemented>::Assoc>;