2023-06-22 13:53:34 -05:00
|
|
|
// ignore-tidy-linelength
|
|
|
|
//@ edition:2021
|
2024-03-10 20:18:41 -05:00
|
|
|
//@ revisions: current next
|
|
|
|
//@ ignore-compare-mode-next-solver (explicit revisions)
|
2023-12-14 06:11:28 -06:00
|
|
|
//@[next] compile-flags: -Znext-solver
|
2024-03-09 23:14:11 -06:00
|
|
|
//@ check-pass
|
2023-06-22 13:53:34 -05:00
|
|
|
|
|
|
|
#![feature(unboxed_closures)]
|
|
|
|
|
|
|
|
use std::future::Future;
|
|
|
|
|
|
|
|
trait Trait {
|
|
|
|
fn func(&self, _: &str);
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<T> Trait for T
|
|
|
|
where
|
|
|
|
for<'a> T: Fn<(&'a str,)> + Send + Sync,
|
|
|
|
for<'a> <T as FnOnce<(&'a str,)>>::Output: Future<Output = usize> + Send,
|
|
|
|
{
|
|
|
|
fn func(&self, _: &str) {
|
|
|
|
println!("hello!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
async fn strlen(x: &str) -> usize {
|
|
|
|
x.len()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
strlen.func("hi");
|
|
|
|
}
|