3 // revisions: default sa
4 //[sa] compile-flags: -Z save-analysis
5 //-^ To make this the regression test for #75962.
7 #![feature(min_type_alias_impl_trait)]
8 #![feature(impl_trait_in_bindings)]
9 //~^ WARNING the feature `impl_trait_in_bindings` is incomplete
13 // Reduction to `impl Trait`
17 trait FooLike { type Output; }
19 impl<T> FooLike for Foo<T> {
30 /// `T::Assoc` should be normalized to `()` here.
31 fn foo_pass<T: Trait<Assoc=()>>() -> impl FooLike<Output=T::Assoc> {
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 // Reduction using `impl Trait` in bindings
64 mod impl_trait_in_bindings {
67 trait FooLike { type Output; }
69 impl FooLike for Foo {
77 fn foo<T: Trait<Assoc=u32>>() {
78 let _: impl FooLike<Output=T::Assoc> = Foo;
82 // The same applied to `type Foo = impl Bar`s
88 impl<T> Implemented for T {
100 type Ex = impl Trait<Out = <() as Implemented>::Assoc>;