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

invalid message field Data.id #4

Open
makorne opened this issue Jul 29, 2021 · 2 comments
Open

invalid message field Data.id #4

makorne opened this issue Jul 29, 2021 · 2 comments

Comments

@makorne
Copy link

makorne commented Jul 29, 2021

Thank you for the example project.
It is working!!!

But using it in real project with latest rusttc 1.53.0 (53cb7b09b 2021-06-17 makes a strangle issue:

syntax = "proto3";
package main_data;
import "rust.proto";

message Data {
    // generates the Uuid type instead of the string type
    string id = 1 [(rust.codegen).type = UUID];
}

Generates code:

#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Data {
    /// generates the Uuid type instead of the string type
    #[prost(uuid, tag="1")]
    pub id: ::uuid::Uuid,
}

But then follows a build error:

error: proc-macro derive panicked

#[derive(Clone, PartialEq, ::prost::Message)]
  |                            ^^^^^^^^^^^^^^^^
  |
  = help: message: called `Result::unwrap()` on an `Err` value: invalid message field Data.id
          
          Caused by:
              no type attribute

Now I add to project as in example :

prost = "0.8"
url = "2"
uuid = "0.8"

[patch.crates-io]
prost = { git = 'https://github.com/kaiserkarel/prosit' }
prost-derive = { git = 'https://github.com/kaiserkarel/prosit' }
prost-types = { git = 'https://github.com/kaiserkarel/prosit' }
prost-build = { git = 'https://github.com/kaiserkarel/prosit' }

May be I should use something like:

#[macro_use]
pub extern crate prost_derive;

What do you think about this issue?
Any ideas?

@KaiserKarel
Copy link
Owner

KaiserKarel commented Aug 4, 2021

Could you check what version of prost-build is used in the build.rs? And does the example compile for you? To me it seems like the correct prost-build handled the proto, but regular prost is used in the derive.

@makorne
Copy link
Author

makorne commented Aug 16, 2021

Your example compiled and the generated types work in his main {}.

But if the generated types are used in elementary workspace project - emerges this problem.
Please take a look.
I created test workspace here: https://github.com/makorne/prosit_workspace_test.git

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