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

Feature so that prost-types depends on prost-derive only optionally. #1075

Closed
wants to merge 1 commit into from

Conversation

ernoc
Copy link

@ernoc ernoc commented May 24, 2024

No description provided.

@caspermeijn
Copy link
Collaborator

Can you explain when this is useful?

@ernoc ernoc marked this pull request as draft May 24, 2024 12:13
@ernoc
Copy link
Author

ernoc commented May 24, 2024

When using Bazel+rules_rust instead of Cargo, depending on prost-derive makes the entire crate index require std, which makes it impossible to build for bare metal. One workaround is to not depend on prost-derive as a "dep", and add the dependency as a proc macro (e.g. https://github.com/project-oak/oak/blob/88928b96e1fe72d173c106f511d7f6537ed30000/micro_rpc/BUILD#L30) .

The approach in this PR, however, doesn't seem to work, unless we were open to changing CI tests to always have "derive" feature active for prost-types.

PD: I'm making this PR a draft for now.

@caspermeijn
Copy link
Collaborator

When using Bazel+rules_rust instead of Cargo, depending on prost-derive makes the entire crate index require std, which makes it impossible to build for bare metal. One workaround is to not depend on prost-derive as a "dep", and add the dependency as a proc macro (e.g. https://github.com/project-oak/oak/blob/88928b96e1fe72d173c106f511d7f6537ed30000/micro_rpc/BUILD#L30) .

That seems like a bug in bazel. Because prost-derive only runs on the host.

The approach in this PR, however, doesn't seem to work, unless we were open to changing CI tests to always have "derive" feature active for prost-types.

I believe that prost-types without prost-derive is not useful, as it could never compile all the useful types in protobuf.rs. Am I right?

@caspermeijn
Copy link
Collaborator

I will close this for now. Please re-open when you think you have new information.

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

Successfully merging this pull request may close these issues.

2 participants