Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing Debug implementation on Oneof generated enum #397

Closed
oysterpack opened this issue Mar 11, 2019 · 1 comment
Closed

missing Debug implementation on Oneof generated enum #397

oysterpack opened this issue Mar 11, 2019 · 1 comment

Comments

@oysterpack
Copy link

example.proto

syntax = "proto3";

import "google/protobuf/any.proto";

package protos;

message ErrorStatus {
    string message = 1;
    repeated google.protobuf.Any details = 2;
}

message SampleMessage {
    oneof result {
        string name = 1;
        ErrorStatus error_status = 2;
    }
}

triggers the following compile error when using #![deny(missing_debug_implementations)]

error: type does not implement `fmt::Debug`; consider adding #[derive(Debug)] or a manual implementation
   --> oysterpack-trust-grpc/src/protos/metrics.rs:246:1
    |
246 | / pub enum SampleMessage_oneof_result {
247 | |     name(::std::string::String),
248 | |     error_status(ErrorStatus),
249 | | }
    | |_^
    |

In this simple case, Debug may be automatically derived to resolve the issue

#[derive(Clone,PartialEq,Debug)]
pub enum SampleMessage_oneof_result {
    name(::std::string::String),
    error_status(ErrorStatus),
}

The work around is to annotate the module containing the generated protoc code with
#[allow(missing_debug_implementations)]

@stepancheg
Copy link
Owner

Implemented as 8a9c5ee, backported to 2.5 branch, not yet released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants