rust/tests/ui/higher-ranked/trait-bounds/future.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
592 B
Rust
Raw Normal View History

2023-06-22 13:53:34 -05:00
// ignore-tidy-linelength
//@ edition:2021
//@ 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");
}