1 // build-pass (FIXME(62277): could be check-pass?)
3 // compile-flags: --crate-type lib
5 #![feature(in_band_lifetimes)]
7 use std::future::Future;
9 pub async fn simple_generic<T>() {}
16 impl Foo for FooType {}
18 pub async fn call_generic_bound<F: Foo>(f: F) {
22 pub async fn call_where_clause<F>(f: F)
29 pub async fn call_impl_trait(f: impl Foo) {
33 pub async fn call_with_ref(f: &impl Foo) {
37 pub fn async_fn_with_same_generic_params_unifies() {
38 let mut a = call_generic_bound(FooType);
39 a = call_generic_bound(FooType);
41 let mut b = call_where_clause(FooType);
42 b = call_where_clause(FooType);
44 let mut c = call_impl_trait(FooType);
45 c = call_impl_trait(FooType);
49 let mut d = call_with_ref(&f_one);
50 d = call_with_ref(&f_two);
53 pub fn simple_generic_block<T>() -> impl Future<Output = ()> {
57 pub fn call_generic_bound_block<F: Foo>(f: F) -> impl Future<Output = ()> {
58 async move { f.foo() }
61 pub fn call_where_clause_block<F>(f: F) -> impl Future<Output = ()>
65 async move { f.foo() }
68 pub fn call_impl_trait_block(f: impl Foo) -> impl Future<Output = ()> {
69 async move { f.foo() }
72 pub fn call_with_ref_block<'a>(f: &'a (impl Foo + 'a)) -> impl Future<Output = ()> + 'a {
73 async move { f.foo() }
76 pub fn call_with_ref_block_in_band(f: &'a (impl Foo + 'a)) -> impl Future<Output = ()> + 'a {
77 async move { f.foo() }
80 pub fn async_block_with_same_generic_params_unifies() {
81 let mut a = call_generic_bound_block(FooType);
82 a = call_generic_bound_block(FooType);
84 let mut b = call_where_clause_block(FooType);
85 b = call_where_clause_block(FooType);
87 let mut c = call_impl_trait_block(FooType);
88 c = call_impl_trait_block(FooType);
92 let mut d = call_with_ref_block(&f_one);
93 d = call_with_ref_block(&f_two);
97 let mut d = call_with_ref_block_in_band(&f_one);
98 d = call_with_ref_block_in_band(&f_two);