Skip to content

Commit

Permalink
Rollup merge of rust-lang#119376 - msrd0:regression-test-106630, r=pe…
Browse files Browse the repository at this point in the history
…trochenkov

Add regression test for rust-lang#106630

This PR adds a regression test for rust-lang#106630. I was unsure where exactly to place the test or how to test it locally so please let me know if I should change something.
  • Loading branch information
matthiaskrgr committed Dec 28, 2023
2 parents 54bcb07 + a88c9a6 commit 77c23b3
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 77c23b3

Please sign in to comment.