about summary refs log tree commit diff
path: root/src/test/ui/async-await/async-with-closure.rs
blob: 2b69c9b701a42d61cd3dab0eb1f4b7d1137c2df1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// build-pass (FIXME(62277): could be check-pass?)
// edition:2018

#![feature(async_await, await_macro)]

trait MyClosure {
    type Args;
}

impl<R> MyClosure for dyn FnMut() -> R
where R: 'static {
    type Args = ();
}

struct MyStream<C: ?Sized + MyClosure> {
    x: C::Args,
}

async fn get_future<C: ?Sized + MyClosure>(_stream: MyStream<C>) {}

async fn f() {
    let messages: MyStream<dyn FnMut()> = unimplemented!();
    await!(get_future(messages));
}

fn main() {}