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

Bug on codegen in ::prost::Enumeration #927

Open
0xAlcibiades opened this issue Sep 28, 2023 · 7 comments
Open

Bug on codegen in ::prost::Enumeration #927

0xAlcibiades opened this issue Sep 28, 2023 · 7 comments

Comments

@0xAlcibiades
Copy link

0xAlcibiades commented Sep 28, 2023

error[E0119]: conflicting implementations of trait `TryFrom<i32>` for type `grpc_codegen::Action`
   --> /Users/bapperson/Code/MyProjects/valorem/trade-api/target/debug/build/mycodegen/out/mycodegen.v1.rs:341:68
    |
341 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
    |                                                                    ^^^^^^^^^^^^^^^^^^^^
    |
    = note: conflicting implementation in crate `core`:
            - impl<T, U> TryFrom<U> for T
              where U: Into<T>;
    = note: this error originates in the derive macro `::prost::Enumeration` (in Nightly builds, run with -Z macro-backtrace for more info)

Using tonic 0.10.1 and prost-types/prost 0.12.1, on building codegen for proto with an enumeration defined:

pub enum Action {
    Buy = 0,
    Sell = 1,
    Invalid = 255,
}

I see this bug, which prevents build from succeeding. This appears to be a regression in 0.9.2->0.10.1 tonic and 0.11.9 prost.

This was also noted in #812 in a recent comment.

@0xAlcibiades
Copy link
Author

Bump on this @LucioFranco or another maintainer. Would be glad to pitch in here, it's preventing a major version update for anyone using enums.

@li3p
Copy link

li3p commented Oct 11, 2023

May I kindly inquire about the latest developments regarding this issue and if there are any temporary solutions available at the moment?

@0xAlcibiades
Copy link
Author

May I kindly inquire about the latest developments regarding this issue and if there are any temporary solutions available at the moment?

Using the previous minor version for now.

@0xAlcibiades
Copy link
Author

@LucioFranco or other maintainer, any desire for a fix here?

@LucioFranco
Copy link
Member

Hi @0xAlcibiades sorry about the delay. I don't have time right now to come up with a fix but I can review a PR if someone is interested in picking up that work.

@0xAlcibiades
Copy link
Author

@LucioFranco Yeah, I think it'll involve reverting the changes, or fixing the changes from #853

@0xAlcibiades
Copy link
Author

@LucioFranco @megsdevs put in PR #955 to resolve this issue.

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