1 // build-pass (FIXME(62277): could be check-pass?)
3 // compile-flags: --crate-type lib
5 use std::future::Future;
7 pub async fn simple_generic<T>() {}
14 impl Foo for FooType {}
16 pub async fn call_generic_bound<F: Foo>(f: F) {
20 pub async fn call_where_clause<F>(f: F)
27 pub async fn call_impl_trait(f: impl Foo) {
31 pub async fn call_with_ref(f: &impl Foo) {
35 pub fn async_fn_with_same_generic_params_unifies() {
36 let mut a = call_generic_bound(FooType);
37 a = call_generic_bound(FooType);
39 let mut b = call_where_clause(FooType);
40 b = call_where_clause(FooType);
42 let mut c = call_impl_trait(FooType);
43 c = call_impl_trait(FooType);
47 let mut d = call_with_ref(&f_one);
48 d = call_with_ref(&f_two);
51 pub fn simple_generic_block<T>() -> impl Future<Output = ()> {
55 pub fn call_generic_bound_block<F: Foo>(f: F) -> impl Future<Output = ()> {
56 async move { f.foo() }
59 pub fn call_where_clause_block<F>(f: F) -> impl Future<Output = ()>
63 async move { f.foo() }
66 pub fn call_impl_trait_block(f: impl Foo) -> impl Future<Output = ()> {
67 async move { f.foo() }
70 pub fn call_with_ref_block<'a>(f: &'a (impl Foo + 'a)) -> impl Future<Output = ()> + 'a {
71 async move { f.foo() }
74 pub fn async_block_with_same_generic_params_unifies() {
75 let mut a = call_generic_bound_block(FooType);
76 a = call_generic_bound_block(FooType);
78 let mut b = call_where_clause_block(FooType);
79 b = call_where_clause_block(FooType);
81 let mut c = call_impl_trait_block(FooType);
82 c = call_impl_trait_block(FooType);
86 let mut d = call_with_ref_block(&f_one);
87 d = call_with_ref_block(&f_two);