From 3dcf0eac12c7148a29fc09f79100b09a45922ce0 Mon Sep 17 00:00:00 2001 From: Jon Gjengset Date: Mon, 27 Jul 2020 11:27:24 -0400 Subject: [PATCH] Remove workaround For https://github.com/rust-lang/rust/issues/65863. --- noria/src/controller.rs | 6 ----- noria/src/doc_mock.rs | 50 ----------------------------------------- noria/src/lib.rs | 2 -- noria/src/table.rs | 9 -------- noria/src/view.rs | 9 -------- 5 files changed, 76 deletions(-) delete mode 100644 noria/src/doc_mock.rs diff --git a/noria/src/controller.rs b/noria/src/controller.rs index 8ee2ee4b0..1a1414692 100644 --- a/noria/src/controller.rs +++ b/noria/src/controller.rs @@ -58,10 +58,7 @@ where type Response = hyper::body::Bytes; type Error = failure::Error; - #[cfg(not(doc))] type Future = impl Future> + Send; - #[cfg(doc)] - type Future = crate::doc_mock::Future>; fn poll_ready(&mut self, _: &mut Context<'_>) -> Poll> { Poll::Ready(Ok(())) @@ -175,10 +172,7 @@ impl ControllerHandle { // this alias is needed to work around -> impl Trait capturing _all_ lifetimes by default // the A parameter is needed so it gets captured into the impl Trait -#[cfg(not(doc))] type RpcFuture = impl Future>; -#[cfg(doc)] -type RpcFuture = crate::doc_mock::FutureWithExtra, A>; // Needed b/c of https://github.com/rust-lang/rust/issues/65442 async fn finalize( diff --git a/noria/src/doc_mock.rs b/noria/src/doc_mock.rs deleted file mode 100644 index 51428f253..000000000 --- a/noria/src/doc_mock.rs +++ /dev/null @@ -1,50 +0,0 @@ -//! This module exists entirely to work around https://github.com/rust-lang/rust/issues/65863 - -/// impl Discover. -/// -/// https://github.com/rust-lang/rust/issues/65863 -pub struct Discover(std::marker::PhantomData); - -impl tower_discover::Discover for Discover { - type Key = usize; - type Service = S; - type Error = tokio::io::Error; - - fn poll_discover( - self: std::pin::Pin<&mut Self>, - _: &mut std::task::Context<'_>, - ) -> std::task::Poll, Self::Error>> - { - loop {} - } -} - -/// impl Future. -/// -/// https://github.com/rust-lang/rust/issues/65863 -pub struct Future(std::marker::PhantomData); - -impl std::future::Future for Future { - type Output = O; - fn poll( - self: std::pin::Pin<&mut Self>, - _: &mut std::task::Context<'_>, - ) -> std::task::Poll { - loop {} - } -} - -/// impl Future. -/// -/// https://github.com/rust-lang/rust/issues/65863 -pub struct FutureWithExtra(std::marker::PhantomData, std::marker::PhantomData); - -impl std::future::Future for FutureWithExtra { - type Output = O; - fn poll( - self: std::pin::Pin<&mut Self>, - _: &mut std::task::Context<'_>, - ) -> std::task::Poll { - loop {} - } -} diff --git a/noria/src/lib.rs b/noria/src/lib.rs index 5906d3116..b1e0c74b3 100644 --- a/noria/src/lib.rs +++ b/noria/src/lib.rs @@ -215,8 +215,6 @@ pub mod channel; #[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411 pub mod consensus; #[doc(hidden)] -pub mod doc_mock; -#[doc(hidden)] #[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411 pub mod internal; diff --git a/noria/src/table.rs b/noria/src/table.rs index 1b78f8e7e..731ea2c8b 100644 --- a/noria/src/table.rs +++ b/noria/src/table.rs @@ -214,10 +214,7 @@ impl Service<()> for Endpoint { type Response = InnerService; type Error = tokio::io::Error; - #[cfg(not(doc))] type Future = impl Future>; - #[cfg(doc)] - type Future = crate::doc_mock::Future>; fn poll_ready(&mut self, _: &mut Context<'_>) -> Poll> { Poll::Ready(Ok(())) @@ -260,12 +257,9 @@ fn make_table_discover(addr: SocketAddr) -> Discover { } // Unpin + Send bounds are needed due to https://github.com/rust-lang/rust/issues/55997 -#[cfg(not(doc))] type Discover = impl tower_discover::Discover + Unpin + Send; -#[cfg(doc)] -type Discover = crate::doc_mock::Discover; pub(crate) type TableRpc = Buffer< ConcurrencyLimit>>>, @@ -585,10 +579,7 @@ impl Service> for Table { type Error = TableError; type Response = >>>::Response; - #[cfg(not(doc))] type Future = impl Future, TableError>> + Send; - #[cfg(doc)] - type Future = crate::doc_mock::Future, TableError>>; fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll> { for s in &mut self.shards { diff --git a/noria/src/view.rs b/noria/src/view.rs index 52757b8aa..25ac94cac 100644 --- a/noria/src/view.rs +++ b/noria/src/view.rs @@ -41,10 +41,7 @@ impl Service<()> for Endpoint { type Response = InnerService; type Error = tokio::io::Error; - #[cfg(not(doc))] type Future = impl Future>; - #[cfg(doc)] - type Future = crate::doc_mock::Future>; fn poll_ready(&mut self, _: &mut Context<'_>) -> Poll> { Poll::Ready(Ok(())) @@ -85,12 +82,9 @@ fn make_views_discover(addr: SocketAddr) -> Discover { } // Unpin + Send bounds are needed due to https://github.com/rust-lang/rust/issues/55997 -#[cfg(not(doc))] type Discover = impl tower_discover::Discover + Unpin + Send; -#[cfg(doc)] -type Discover = crate::doc_mock::Discover; pub(crate) type ViewRpc = Buffer>>, Tagged>; @@ -241,10 +235,7 @@ impl Service<(Vec>, bool)> for View { type Response = Vec; type Error = ViewError; - #[cfg(not(doc))] type Future = impl Future> + Send; - #[cfg(doc)] - type Future = crate::doc_mock::Future>; fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll> { for s in &mut self.shards {