// revisions: current next //[next] compile-flags: -Ztrait-solver=next // edition:2021 mod hyper { use std::{fmt::Debug, future::Future, marker::PhantomData, pin::Pin, task::Poll}; pub trait HttpBody { type Error; } impl HttpBody for () { //~^ ERROR not all trait items implemented, missing: `Error` // don't implement `Error` here for the ICE } pub struct Server(I, S); pub fn serve(_: S) -> Server { todo!() } impl Future for Server<(), S> where S: MakeServiceRef<(), (), ResBody = B>, B: HttpBody, B::Error: Debug, { type Output = (); fn poll(self: Pin<&mut Self>, _: &mut std::task::Context<'_>) -> Poll { todo!() } } pub trait MakeServiceRef { type ResBody; } impl MakeServiceRef<(), ()> for T where T: for<'a> Service<&'a (), Response = S>, S: Service<()>, { type ResBody = (); } pub struct MakeServiceFn(pub F); pub struct ServiceFn(pub PhantomData<(F, R)>); pub trait Service { type Response; } impl<'t, F, Ret, Target, Svc> Service<&'t Target> for MakeServiceFn where F: Fn() -> Ret, Ret: Future>, { type Response = Svc; } impl Service for ServiceFn where F: Fn() -> Ret, Ret: Future>, { type Response = ResBody; } } async fn smarvice() -> Result<(), ()> { Ok(()) } fn service_fn(f: F) -> hyper::ServiceFn where F: Fn() -> S, { hyper::ServiceFn(std::marker::PhantomData) } async fn iceice() { let service = hyper::MakeServiceFn(|| async { Ok::<_, ()>(service_fn(|| smarvice())) }); hyper::serve::<(), _>(service).await; } fn main() {}