Skip to content

Commit a88c9a6

Browse files
committed
Add regression test for rust-lang#106630
1 parent 625c2c4 commit a88c9a6

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// edition:2018
2+
// run-pass
3+
4+
use std::future::Future;
5+
6+
trait AsyncCallback<'a> {
7+
type Out;
8+
}
9+
10+
impl<'a, Fut, T, F> AsyncCallback<'a> for F
11+
where
12+
F: FnOnce(&'a mut ()) -> Fut,
13+
Fut: Future<Output = T> + Send + 'a,
14+
{
15+
type Out = T;
16+
}
17+
18+
trait CallbackMarker {}
19+
20+
impl<F, T> CallbackMarker for F
21+
where
22+
T: 'static,
23+
for<'a> F: AsyncCallback<'a, Out = T> + Send,
24+
{
25+
}
26+
27+
fn do_sth<F: CallbackMarker>(_: F) {}
28+
29+
async fn callback(_: &mut ()) -> impl Send {}
30+
31+
fn main() {
32+
do_sth(callback);
33+
}

0 commit comments

Comments
 (0)