stepancheg / grpc-rust

Rust implementation of gRPC
MIT License
1.37k stars 124 forks source link

grpc v0.2.1 fail to compile #114

Closed zqzqz closed 6 years ago

zqzqz commented 6 years ago

on ubuntu cargo 0.26.0-nightly

run cargo test in directory grpc-0.2.1 and an error occurs. It seems caused by inconsistent version of futures?

    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling lazycell v0.6.0                                                    
   Compiling scopeguard v0.3.3
   Compiling either v1.5.0
   Compiling lazy_static v1.0.0
   Compiling cfg-if v0.1.2
   Compiling byteorder v1.2.2
   Compiling nodrop v0.1.12
   Compiling scoped-tls v0.1.1
   Compiling futures v0.1.21
   Compiling memoffset v0.2.1
   Compiling safemem v0.2.0
   Compiling slab v0.3.0
   Compiling void v1.0.2
   Compiling libc v0.2.40
   Compiling slab v0.4.0
   Compiling crossbeam-utils v0.2.2
   Compiling crossbeam-utils v0.3.2
   Compiling log v0.4.1
   Compiling futures-core v0.2.0
   Compiling arrayvec v0.4.7
   Compiling base64 v0.9.0
   Compiling net2 v0.2.32
   Compiling rand v0.4.2
   Compiling unix_socket v0.5.0
   Compiling num_cpus v1.8.0
   Compiling iovec v0.1.2
   Compiling futures-channel v0.2.0
   Compiling log v0.3.9
   Compiling tls-api v0.1.19
   Compiling crossbeam-epoch v0.4.1
   Compiling tokio-timer v0.1.2
   Compiling tokio-executor v0.1.2
   Compiling futures-cpupool v0.1.8
   Compiling mio v0.6.14
   Compiling bytes v0.4.6
   Compiling futures-io v0.2.0
   Compiling futures-sink v0.2.0
   Compiling tls-api-stub v0.1.19
   Compiling tokio-timer v0.2.1
   Compiling crossbeam-deque v0.3.0
   Compiling futures-util v0.2.0
   Compiling tokio-threadpool v0.1.2
   Compiling tokio-io v0.1.6
   Compiling protobuf v1.5.1
   Compiling mio-uds v0.6.4
   Compiling tokio-reactor v0.1.1
   Compiling futures-executor v0.2.0
   Compiling tokio-tcp v0.1.0
   Compiling tokio-udp v0.1.0
   Compiling futures-stable v0.2.0
   Compiling futures v0.2.0
   Compiling tokio v0.1.5
   Compiling tokio-core v0.1.17
   Compiling tokio-uds v0.1.7
   Compiling tokio-tls-api v0.1.19
   Compiling httpbis v0.4.5
   Compiling grpc v0.2.1 (file:///root/.cargo/registry/src/github.com-1ecc6299db9ec823/grpc-0.2.1)
error[E0432]: unresolved import `futures::BoxFuture`
 --> src/futures_grpc.rs:1:5
  |
1 | use futures::BoxFuture;
  |     ^^^^^^^^^^^^^^^^^^ no `BoxFuture` in the root. Did you mean to use `Future`?

error[E0432]: unresolved import `futures::stream::BoxStream`
 --> src/futures_grpc.rs:2:5
  |
2 | use futures::stream::BoxStream;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ no `BoxStream` in `stream`. Did you mean to use `Stream`?

error[E0432]: unresolved import `futures::BoxFuture`
 --> src/futures_grpc.rs:1:5
  |
1 | use futures::BoxFuture;
  |     ^^^^^^^^^^^^^^^^^^ no `BoxFuture` in the root. Did you mean to use `Future`?

error[E0432]: unresolved import `futures::stream::BoxStream`
 --> src/futures_grpc.rs:2:5
  |
2 | use futures::stream::BoxStream;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ no `BoxStream` in `stream`. Did you mean to use `Stream`?

error[E0433]: failed to resolve. Could not find `sync` in `futures`
   --> src/client.rs:124:39
    |
124 |         -> futures::Oneshot<(futures::sync::mpsc::UnboundedSender<ResultOrEof<Resp, Error>>, GrpcStream<Resp>)>
    |                                       ^^^^ Could not find `sync` in `futures`

error[E0433]: failed to resolve. Could not find `sync` in `futures`
   --> src/client.rs:128:43
    |
128 |         let (sender, receiver) = futures::sync::mpsc::unbounded();
    |                                           ^^^^ Could not find `sync` in `futures`

error[E0407]: method `poll` is not a member of trait `Stream`
   --> src/grpc_frame.rs:163:5
    |
163 | /     fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
164 | |         loop {
165 | |             if let Some(ref mut error) = self.error {
166 | |                 return error.poll();
...   |
201 | |         }
202 | |     }
    | |_____^ not a member of trait `Stream`

error[E0407]: method `poll` is not a member of trait `Stream`
   --> src/grpc_http_to_response.rs:90:5
    |
90  | /     fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
91  | |         loop {
92  | |             if let Some(ref mut error) = self.error {
93  | |                 return error.poll();
...   |
151 | |         }
152 | |     }
    | |_____^ not a member of trait `Stream`

error[E0433]: failed to resolve. Could not find `sync` in `futures`
   --> src/client.rs:124:39
    |
124 |         -> futures::Oneshot<(futures::sync::mpsc::UnboundedSender<ResultOrEof<Resp, Error>>, GrpcStream<Resp>)>
    |                                       ^^^^ Could not find `sync` in `futures`

error[E0433]: failed to resolve. Could not find `sync` in `futures`
   --> src/client.rs:128:43
    |
128 |         let (sender, receiver) = futures::sync::mpsc::unbounded();
    |                                           ^^^^ Could not find `sync` in `futures`

error[E0407]: method `poll` is not a member of trait `Stream`
   --> src/grpc_frame.rs:163:5
    |
163 | /     fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
164 | |         loop {
165 | |             if let Some(ref mut error) = self.error {
166 | |                 return error.poll();
...   |
201 | |         }
202 | |     }
    | |_____^ not a member of trait `Stream`

error[E0407]: method `poll` is not a member of trait `Stream`
   --> src/grpc_http_to_response.rs:90:5
    |
90  | /     fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
91  | |         loop {
92  | |             if let Some(ref mut error) = self.error {
93  | |                 return error.poll();
...   |
151 | |         }
152 | |     }
    | |_____^ not a member of trait `Stream`

error[E0412]: cannot find type `Oneshot` in module `futures`
   --> src/client.rs:124:21
    |
124 |         -> futures::Oneshot<(futures::sync::mpsc::UnboundedSender<ResultOrEof<Resp, Error>>, GrpcStream<Resp>)>
    |                     ^^^^^^^ not found in `futures`

error[E0425]: cannot find function `oneshot` in module `futures`
   --> src/client.rs:126:51
    |
126 |         let (one_sender, one_receiver) = futures::oneshot();
    |                                                   ^^^^^^^ not found in `futures`

error[E0425]: cannot find function `iter` in module `stream`
  --> src/stream_item.rs:63:53
   |
63 |         GrpcStreamWithTrailingMetadata::new(stream::iter(vec![
   |                                                     ^^^^ not found in `stream`

error[E0425]: cannot find function `iter` in module `stream`
  --> src/stream_item.rs:75:56
   |
75 |         GrpcStreamWithTrailingMetadata::stream(stream::iter(iter.into_iter().map(Ok)))
   |                                                        ^^^^ not found in `stream`

error[E0425]: cannot find function `iter` in module `stream`
  --> src/req.rs:42:39
   |
42 |         StreamingRequest::new(stream::iter(iter.into_iter().map(Ok)))
   |                                       ^^^^ not found in `stream`

error[E0425]: cannot find function `finished` in module `future`
  --> src/resp.rs:43:37
   |
43 |         SingleResponse::new(future::finished((metadata, future)))
   |                                     ^^^^^^^^ not found in `future`

error[E0425]: cannot find function `iter` in module `stream`
  --> src/resp.rs:84:25
   |
84 |                 stream::iter(vec![
   |                         ^^^^ not found in `stream`

error[E0425]: cannot find function `iter` in module `stream`
   --> src/resp.rs:157:21
    |
157 |             stream::iter(iter.map(Ok)),
    |                     ^^^^ not found in `stream`

error[E0412]: cannot find type `Canceled` in module `futures`
  --> src/error.rs:27:23
   |
27 |     Canceled(futures::Canceled),
   |                       ^^^^^^^^ not found in `futures`
help: possible candidate is found in another module, you can import it into scope
   |
1  | use futures::channel::oneshot::Canceled;
   |

error[E0412]: cannot find type `Canceled` in module `futures`
  --> src/error.rs:89:20
   |
89 | impl From<futures::Canceled> for Error {
   |                    ^^^^^^^^ not found in `futures`
help: possible candidate is found in another module, you can import it into scope
   |
1  | use futures::channel::oneshot::Canceled;
   |

error[E0412]: cannot find type `Canceled` in module `futures`
  --> src/error.rs:90:27
   |
90 |     fn from(err: futures::Canceled) -> Self {
   |                           ^^^^^^^^ not found in `futures`
help: possible candidate is found in another module, you can import it into scope
   |
1  | use futures::channel::oneshot::Canceled;
   |

error[E0412]: cannot find type `Oneshot` in module `futures`
   --> src/client.rs:124:21
    |
124 |         -> futures::Oneshot<(futures::sync::mpsc::UnboundedSender<ResultOrEof<Resp, Error>>, GrpcStream<Resp>)>
    |                     ^^^^^^^ not found in `futures`

error[E0425]: cannot find function `oneshot` in module `futures`
   --> src/client.rs:126:51
    |
126 |         let (one_sender, one_receiver) = futures::oneshot();
    |                                                   ^^^^^^^ not found in `futures`

error[E0425]: cannot find function `iter` in module `stream`
  --> src/stream_item.rs:63:53
   |
63 |         GrpcStreamWithTrailingMetadata::new(stream::iter(vec![
   |                                                     ^^^^ not found in `stream`
help: possible candidate is found in another module, you can import it into scope
   |
1  | use __test::test::iter;
   |

error[E0425]: cannot find function `iter` in module `stream`
  --> src/stream_item.rs:75:56
   |
75 |         GrpcStreamWithTrailingMetadata::stream(stream::iter(iter.into_iter().map(Ok)))
   |                                                        ^^^^ not found in `stream`
help: possible candidate is found in another module, you can import it into scope
   |
1  | use __test::test::iter;
   |

error[E0425]: cannot find function `iter` in module `stream`
  --> src/req.rs:42:39
   |
42 |         StreamingRequest::new(stream::iter(iter.into_iter().map(Ok)))
   |                                       ^^^^ not found in `stream`
help: possible candidate is found in another module, you can import it into scope
   |
1  | use __test::test::iter;
   |

error[E0425]: cannot find function `finished` in module `future`
  --> src/resp.rs:43:37
   |
43 |         SingleResponse::new(future::finished((metadata, future)))
   |                                     ^^^^^^^^ not found in `future`

error[E0425]: cannot find function `iter` in module `stream`
  --> src/resp.rs:84:25
   |
84 |                 stream::iter(vec![
   |                         ^^^^ not found in `stream`
help: possible candidate is found in another module, you can import it into scope
   |
1  | use __test::test::iter;
   |

error[E0425]: cannot find function `iter` in module `stream`
   --> src/resp.rs:157:21
    |
157 |             stream::iter(iter.map(Ok)),
    |                     ^^^^ not found in `stream`
help: possible candidate is found in another module, you can import it into scope
    |
1   | use __test::test::iter;
    |

error[E0412]: cannot find type `Canceled` in module `futures`
  --> src/error.rs:27:23
   |
27 |     Canceled(futures::Canceled),
   |                       ^^^^^^^^ not found in `futures`
help: possible candidate is found in another module, you can import it into scope
   |
1  | use futures::channel::oneshot::Canceled;
   |

error[E0412]: cannot find type `Canceled` in module `futures`
  --> src/error.rs:89:20
   |
89 | impl From<futures::Canceled> for Error {
   |                    ^^^^^^^^ not found in `futures`
help: possible candidate is found in another module, you can import it into scope
   |
1  | use futures::channel::oneshot::Canceled;
   |

warning: unused import: `futures::stream::Stream`
 --> src/client.rs:7:5
  |
7 | use futures::stream::Stream;
  |     ^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: #[warn(unused_imports)] on by default

error[E0412]: cannot find type `Canceled` in module `futures`
  --> src/error.rs:90:27
   |
90 |     fn from(err: futures::Canceled) -> Self {
   |                           ^^^^^^^^ not found in `futures`
help: possible candidate is found in another module, you can import it into scope
   |
1  | use futures::channel::oneshot::Canceled;
   |

warning: unused import: `std::net::ToSocketAddrs`
 --> src/server.rs:3:5
  |
3 | use std::net::ToSocketAddrs;
  |     ^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `futures_cpupool::CpuPool`
 --> src/server.rs:5:5
  |
5 | use futures_cpupool::CpuPool;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `futures::Future`
  --> src/server.rs:22:5
   |
22 | use futures::Future;
   |     ^^^^^^^^^^^^^^^

warning: unused import: `futures::stream::Stream`
  --> src/server.rs:24:5
   |
24 | use futures::stream::Stream;
   |     ^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `futures::future::Future`
 --> src/server_method.rs:8:5
  |
8 | use futures::future::Future;
  |     ^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `futures::stream::Stream`
 --> src/server_method.rs:9:5
  |
9 | use futures::stream::Stream;
  |     ^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `futures::stream::Stream`
 --> src/client.rs:7:5
  |
7 | use futures::stream::Stream;
  |     ^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: #[warn(unused_imports)] on by default

warning: unused import: `std::net::ToSocketAddrs`
 --> src/server.rs:3:5
  |
3 | use std::net::ToSocketAddrs;
  |     ^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `futures_cpupool::CpuPool`
 --> src/server.rs:5:5
  |
5 | use futures_cpupool::CpuPool;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `futures::Future`
  --> src/server.rs:22:5
   |
22 | use futures::Future;
   |     ^^^^^^^^^^^^^^^

warning: unused import: `futures::stream::Stream`
  --> src/server.rs:24:5
   |
24 | use futures::stream::Stream;
   |     ^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `futures::future::Future`
 --> src/server_method.rs:8:5
  |
8 | use futures::future::Future;
  |     ^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `futures::stream::Stream`
 --> src/server_method.rs:9:5
  |
9 | use futures::stream::Stream;
  |     ^^^^^^^^^^^^^^^^^^^^^^^

error[E0244]: wrong number of type arguments: expected 1, found 2
   --> src/grpc_frame.rs:144:19
    |
144 |     error: Option<stream::Once<Bytes, Error>>,
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 type argument

error[E0244]: wrong number of type arguments: expected 1, found 2
  --> src/grpc_http_to_response.rs:72:19
   |
72 |     error: Option<stream::Once<ItemOrMetadata<Bytes>, Error>>,
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 type argument

error: aborting due to 19 previous errors

error[E0244]: wrong number of type arguments: expected 1, found 2
   --> src/grpc_frame.rs:144:19
    |
144 |     error: Option<stream::Once<Bytes, Error>>,
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 type argument

error: Could not compile `grpc`.
warning: build failed, waiting for other jobs to finish...
error[E0244]: wrong number of type arguments: expected 1, found 2
  --> src/grpc_http_to_response.rs:72:19
   |
72 |     error: Option<stream::Once<ItemOrMetadata<Bytes>, Error>>,
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 type argument

error: aborting due to 19 previous errors

error: Could not compile `grpc`.

To learn more, run the command again with --verbose.
stepancheg commented 6 years ago

Version 0.3.0 fixes the issue. Thanks.

If you need 0.2.1, you can locally override version of futures and tokio to 0.1.