stepancheg / grpc-rust

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

protoc-rust-grpc v0.2.0 crate from crates.io is broken #90

Closed mcilloni closed 7 years ago

mcilloni commented 7 years ago

If I set

[dependencies]
protobuf        = "1.*"
futures         = "0.*"
futures-cpupool = "0.1.*"
tls-api         = "0.*"
httpbis         = "0.4.1"
grpc            = "0.2.0"

[build-dependencies]
protoc-rust-grpc = "0.2.0"

into the Cargo.toml of a project (including grpc_examples, as included by this repo), the protoc compiler generates broken Rust definitions:

error[E0433]: failed to resolve. Could not find `ServerMethod` in `server`
  --> src/helloworld_grpc.rs:99:17
   |
99 |                 ::grpc::server::ServerMethod::new(
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Could not find `ServerMethod` in `server`

error[E0433]: failed to resolve. Could not find `MethodHandlerUnary` in `server`
   --> src/helloworld_grpc.rs:108:25
    |
108 |                         ::grpc::server::MethodHandlerUnary::new(move |o, p| handler_copy.say_hello(o, p))
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Could not find `MethodHandlerUnary` in `server`

[...]

Using the protoc-rust-grpc crate from the current git head instead of 0.2.0 from crates.io works perfectly, without any issue.

The main difference I can see between the two different version is the usage of ::grpc::server (in the code generated by the crates.io release) instead of ::grpc::rt (in the code generated by the crate from git). The second version compiles flawlessly, and everthing works.

stepancheg commented 7 years ago

v0.2.0 had incorrectly specified internal dependency (protoc-rust-grpc depended on grpc-compiler=0.1.10). I've pushed v0.2.1 that should be OK. Thank you for the report!