Skip to content

Commit

Permalink
Add regression test for rust-lang#106630
Browse files Browse the repository at this point in the history
  • Loading branch information
msrd0 committed Dec 28, 2023
1 parent 625c2c4 commit a88c9a6
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/ui/impl-trait/not_general_enough_regression_106630.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// edition:2018
// run-pass

use std::future::Future;

trait AsyncCallback<'a> {
type Out;
}

impl<'a, Fut, T, F> AsyncCallback<'a> for F
where
F: FnOnce(&'a mut ()) -> Fut,
Fut: Future<Output = T> + Send + 'a,
{
type Out = T;
}

trait CallbackMarker {}

impl<F, T> CallbackMarker for F
where
T: 'static,
for<'a> F: AsyncCallback<'a, Out = T> + Send,
{
}

fn do_sth<F: CallbackMarker>(_: F) {}

async fn callback(_: &mut ()) -> impl Send {}

fn main() {
do_sth(callback);
}

0 comments on commit a88c9a6

Please sign in to comment.