You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Darwin june.local 21.6.0 Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:35 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T8101 arm64
Description
I found out an unique bug, I happened to name my proto service as "Result" because it's supposed to stream the result of a service. Here is my proto definition:
result.proto
syntax = "proto3";
import "google/protobuf/any.proto";
import "google/protobuf/empty.proto";
option go_package = "github.com/stevenhansel/binus-logbook/scraper/internal/grpc/proto/result";
package result;
service Result {
rpc Listen(google.protobuf.Empty) returns (stream Reply) {}
}
message Reply {
int32 step = 1;
string name = 2;
google.protobuf.Any data = 3;
}
Then when I run cargo build where inside in the build.rs looks like:
build.rs
fn main() {
let protos: &'static [&str] = &[
"../proto/helloworld.proto",
"../proto/scraper.proto",
"../proto/result.proto",
];
for proto in protos {
tonic_build::compile_protos(proto)
.unwrap_or_else(|e| panic!("Failed to compile protos {:?}", e));
}
tauri_build::build()
}
It will show this error:
error[E0782]: trait objects must include the `dyn` keyword
--> /Users/june/binus-logbook/src-tauri/target/debug/build/binus-logbook-69ad9dfa394bbbc0/out/result.rs:110:24
|
110 | Item = Result<super::Reply, tonic::Status>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: add `dyn` keyword before this trait
|
110 - Item = Result<super::Reply, tonic::Status>,
110 + Item = dyn Result<super::Reply, tonic::Status>,
|
error[E0107]: this trait takes 0 generic arguments but 2 generic arguments were supplied
--> /Users/june/binus-logbook/src-tauri/target/debug/build/binus-logbook-69ad9dfa394bbbc0/out/result.rs:110:24
|
110 | Item = Result<super::Reply, tonic::Status>,
| ^^^^^^----------------------------- help: remove these generics
| |
| expected 0 generic arguments
|
note: trait defined here, with 0 generic parameters
--> /Users/june/binus-logbook/src-tauri/target/debug/build/binus-logbook-69ad9dfa394bbbc0/out/result.rs:107:15
|
107 | pub trait Result: Send + Sync + 'static {
| ^^^^^^
error[E0191]: the value of the associated type `ListenStream` (from trait `result_server::Result`) must be specified
--> /Users/june/binus-logbook/src-tauri/target/debug/build/binus-logbook-69ad9dfa394bbbc0/out/result.rs:110:24
|
109 | / type ListenStream: futures_core::Stream<
110 | | Item = Result<super::Reply, tonic::Status>,
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: specify the associ
For me the fix was to rename the protobuf service in result.proto to another name.
Yeah, i think this is something that is hard to fix due to Result being imported in the prelude. I would consider changing the name as it may just be incompatible with Rust.
Bug Report
Version
Platform
Description
I found out an unique bug, I happened to name my proto service as "Result" because it's supposed to stream the result of a service. Here is my proto definition:
result.proto
Then when I run
cargo build
where inside in the build.rs looks like:build.rs
It will show this error:
For me the fix was to rename the protobuf service in
result.proto
to another name.result.proto
I'm reporting this bug because it works just fine when I compile the protobuf with
protoc
for the Golang side.The text was updated successfully, but these errors were encountered: