diff --git a/tower/src/lib.rs b/tower/src/lib.rs index 0766fc2..e969727 100644 --- a/tower/src/lib.rs +++ b/tower/src/lib.rs @@ -1,39 +1,25 @@ -use std::marker::PhantomData; -use std::pin::Pin; - -use core::ops::DerefMut; - trait Stream { type Item; } -impl

Stream for Pin

-where - P: DerefMut, - P::Target: Stream, -{ - type Item = ::Item; -} - trait TryStream: Stream { - type Ok; + type TryItem; } impl TryStream for S where S: ?Sized + Stream, { - type Ok = T; + type TryItem = T; } trait Discover { type Service; } -impl Discover for D +impl Discover for D where - D: TryStream, - K: Eq, + D: TryStream, { type Service = S; } @@ -48,7 +34,7 @@ pub trait MakeService { } struct Balance { - _req: PhantomData<(D, Req)>, + _dreq: (D, Req), } impl Balance @@ -66,33 +52,22 @@ impl Service for Balance { type Error = (); } -struct PoolDiscoverer +impl Stream for MS where MS: MakeService, { - _x: MS, + type Item = SvcWrap; } -impl Stream for PoolDiscoverer +pub fn broken() where MS: MakeService, + MS::Error: Into<()>, { - type Item = (usize, SvcWrap); -} + let d: MS = todo!(); -pub struct Builder; - -impl Builder { - pub fn build() - where - MS: MakeService, - MS::Error: Into<()>, - { - let d: PoolDiscoverer = todo!(); - - // THE CRITICAL STATEMENT - let _ = Balance::new(Box::pin(d)); - } + // Error: Apparently Balance::new doesn't exist during MIR validation + let _ = Balance::new(d); } struct SvcWrap(Svc);