stepancheg / rust-protobuf

Rust implementation of Google protocol buffers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Naming conflict when `oneof` begins with Set, fails to compile

sppalkia opened this issue · comments

I have a Protobuf that looks something like this:

message Foo {
  oneof command {
    Bar bar = 1;
    SetBar bar = 2;
  }
}

message Bar {}
message SetBar {}

When I try to compile the Proto, I get an error along the lines of:

71  |     pub fn set_bar(&mut self, v: Bar) {
    |     ---------------------------------------------------------- other definition for `set_bar`
...
101 |     pub fn set_bar(&self) -> &SetBar {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ duplicate definitions for `set_bar`

This is happening even if I set the generate_getter and generator_accessor to false. Is there any good workaround for this? Maybe it be possible to add an option for adding a prefix to getters, e.g., get_, to disambiguate such cases?

Thanks!