rust/tests/ui/async-await/async-closures/post-mono-higher-ranked-hang-2.rs
2025-01-26 18:27:58 +00:00

24 lines
528 B
Rust

//@ edition: 2021
//@ build-fail
// Regression test for <https://github.com/rust-lang/rust/issues/135780>.
use std::future::Future;
use std::ops::AsyncFn;
use std::pin::Pin;
fn recur<'l>(closure: &'l impl AsyncFn()) -> Pin<Box<dyn Future<Output = ()> + 'l>> {
Box::pin(async move {
let _ = closure();
let _ = recur(&async || {
//~^ ERROR reached the recursion limit
let _ = closure();
});
})
}
fn main() {
let closure = async || {};
let _ = recur(&closure);
}