Skip to content

Cannot compile when enum is map value #376

@quininer

Description

@quininer
syntax = "proto2";

enum Command {
	AAA = 0;
}

message CommandMap {
	map<string, Command> map = 1;
}
error[E0277]: the trait bound `bad::Command: std::default::Default` is not satisfied
  --> src/bad.rs:74:21
   |
74 |                     ::protobuf::rt::read_map_into::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeEnum<Command>>(wire_type, is, &mut self.map)?;
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::default::Default` is not implemented for `bad::Command`
   |
   = note: required by `protobuf::rt::read_map_into`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions