blob: 644cba0d47af2014f2b4cdf0ab3c05fcd7a671dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
  | 
//@ edition: 2024
//@ revisions: current next
//@[next] compile-flags: -Znext-solver
//@ check-pass
// Regression test for #146813. We previously used a pseudo-canonical
// query during HIR typeck which caused a query cycle when looking at the
// witness of a coroutine.
use std::future::Future;
trait ConnectMiddleware {}
trait ConnectHandler: Sized {
    fn with<M>(self, _: M) -> impl ConnectHandler
    where
        M: ConnectMiddleware,
    {
        LayeredConnectHandler
    }
}
struct LayeredConnectHandler;
impl ConnectHandler for LayeredConnectHandler {}
impl<F> ConnectHandler for F where F: FnOnce() {}
impl<F, Fut> ConnectMiddleware for F
where
    F: FnOnce() -> Fut,
    Fut: Future<Output = ()> + Send,
{
}
pub async fn fails() {
    { || {} }
        .with(async || ())
        .with(async || ())
        .with(async || ());
}
fn main() {}
 
  |