stepancheg / grpc-rust

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

Generated Rust file contains reference to `super::struct_pb::NullValue::NULL_VALUE` #129

Closed chbaker0 closed 5 years ago

chbaker0 commented 5 years ago

I'm using this library, with protoc-rust-grpc, to to generate Rust code for the Google Cloud Datastore protos defined at https://github.com/googleapis/googleapis. The generated code for Value in entity.proto contains the following code:

    pub fn get_null_value(&self) -> ::protobuf::well_known_types::NullValue {
        match self.value_type {
            ::std::option::Option::Some(Value_oneof_value_type::null_value(v)) => v,
            _ => super::struct_pb::NullValue::NULL_VALUE,
        }
    }

When building, I get the following error:

error[E0433]: failed to resolve. Could not find `struct_pb` in `super`                                   
   --> src/gen/proto/entity.rs:968:25                                                                    
    |                                                                                                    
968 |             _ => super::struct_pb::NullValue::NULL_VALUE,                                          
    |                         ^^^^^^^^^ Could not find `struct_pb` in `super`                            

There's no corresponding definition of struct_pb in the generated files. I'm guessing this should be referring to ::protobuf::well_known_types::struct_pb?

I'm sorry if I'm just doing something wrong here.

Ragnaroek commented 5 years ago

Same here for this file https://github.com/googleapis/googleapis/blob/master/google/firestore/v1/document.proto

It generates the following code that cannot be compiled:

pub fn get_null_value(&self) -> ::protobuf::well_known_types::NullValue {
        match self.value_type {
            ::std::option::Option::Some(Value_oneof_value_type::null_value(v)) => v,
            _ => super::struct_pb::NullValue::NULL_VALUE,
        }
 }
stepancheg commented 5 years ago

Fixed in 2.4.2. Thank you for the reminder!