Rollup merge of #119376 - msrd0:regression-test-106630, r=petrochenkov
Add regression test for #106630 This PR adds a regression test for #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.
This commit is contained in:
commit
77c23b3e94
33
tests/ui/impl-trait/not_general_enough_regression_106630.rs
Normal file
33
tests/ui/impl-trait/not_general_enough_regression_106630.rs
Normal file
@ -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);
|
||||
}
|
Loading…
Reference in New Issue
Block a user