diff --git a/Cargo.lock b/Cargo.lock index fa121a1..9d6c7d8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5,10 +5,3 @@ version = 3 [[package]] name = "aaaa" version = "0.1.0" -dependencies = [ - "tower", -] - -[[package]] -name = "tower" -version = "0.4.13" diff --git a/Cargo.toml b/Cargo.toml index 15138b2..fd8dcb4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,4 +6,3 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -tower = { path = "./tower" } \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index e7a11a9..4dbc9b2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,73 @@ +trait Stream { + type Item; +} + +trait TryStream: Stream { + type TryItem; +} + +impl TryStream for S +where + S: Stream, +{ + type TryItem = T; +} + +trait Discover { + type Service; +} + +impl Discover for D +where + D: TryStream, +{ + type Service = S; +} + +pub trait Service { + type Error; +} + +pub trait MakeService { + type Error; + type Service: Service<(), Error = Self::Error>; +} + +struct Balance { + _dreq: (D, Req), +} + +impl Balance +where + D: Discover, + D::Service: Service, + >::Error: Into<()>, +{ + fn new(_: D) -> Self { + todo!() + } +} + +impl Service for Balance { + type Error = (); +} + +impl Stream for MS +where + MS: MakeService, +{ + type Item = MS::Service; +} + +pub fn broken(ms: MS) +where + MS: MakeService, + MS::Error: Into<()>, +{ + // Error: Apparently Balance::new doesn't exist during MIR validation + let _ = Balance::::new(ms); +} + fn main() { println!("Hello, world!"); } diff --git a/tower/Cargo.toml b/tower/Cargo.toml deleted file mode 100644 index 63ce650..0000000 --- a/tower/Cargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[package] -name = "tower" -version = "0.4.13" -edition = "2018" - -[features] - - -[dependencies] diff --git a/tower/src/lib.rs b/tower/src/lib.rs deleted file mode 100644 index b86aaa0..0000000 --- a/tower/src/lib.rs +++ /dev/null @@ -1,69 +0,0 @@ -trait Stream { - type Item; -} - -trait TryStream: Stream { - type TryItem; -} - -impl TryStream for S -where - S: Stream, -{ - type TryItem = T; -} - -trait Discover { - type Service; -} - -impl Discover for D -where - D: TryStream, -{ - type Service = S; -} - -pub trait Service { - type Error; -} - -pub trait MakeService { - type Error; - type Service: Service<(), Error = Self::Error>; -} - -struct Balance { - _dreq: (D, Req), -} - -impl Balance -where - D: Discover, - D::Service: Service, - >::Error: Into<()>, -{ - fn new(_: D) -> Self { - todo!() - } -} - -impl Service for Balance { - type Error = (); -} - -impl Stream for MS -where - MS: MakeService, -{ - type Item = MS::Service; -} - -pub fn broken(ms: MS) -where - MS: MakeService, - MS::Error: Into<()>, -{ - // Error: Apparently Balance::new doesn't exist during MIR validation - let _ = Balance::::new(ms); -}