Skip to content

Conversation

@jen20
Copy link
Contributor

@jen20 jen20 commented Dec 30, 2025

Motivation

This commit address the issue raised in #2388, where well-known types such as google.protobuf.BoolValue would appear as super::bool rather than the correct primitives.

The issue was reproduced here, and produces the following output when cargo build is run (only the first occurrence is shown):

error[E0412]: cannot find type `bool` in module `super`
  --> /Users/James/Code/personal/tonic-repros/tonic-2388/target/debug/build/tonic-2388-685c45971c3ed332/out/helloworld.rs:95:53
   |
95 |             request: impl tonic::IntoRequest<super::bool>,
   |                                                     ^^^^ not found in `super`
   |
help: consider importing this builtin type
   |
11 +     use std::primitive::bool;
   |
help: if you import `bool`, refer to it directly
   |
95 -             request: impl tonic::IntoRequest<super::bool>,
95 +             request: impl tonic::IntoRequest<bool>,
   |

Solution

We address this by adding new cases to the existing enum for the various wrapper types contained in google/protobuf/wrappers.proto, when not compiling well-known types as proto structs directly. This is broadly in line with the patch suggested in the issue by @zhaohaiyun9, but is a little less broad and adds test coverage.

This commit address the issue raised in hyperium#2388, where well-known types
such as `google.protobuf.BoolValue` would appear as `super::bool` rather
than the correct primitives.

We address this by adding new cases to the existing enum for the various
wrapper types contained in `google/protobuf/wrappers.proto`, when not
compiling well-known types as proto structs directly.
@jen20 jen20 closed this Dec 30, 2025
@jen20 jen20 deleted the jen20/014-fix-wrapper-type-mapping branch December 30, 2025 00:22
@jen20 jen20 restored the jen20/014-fix-wrapper-type-mapping branch December 30, 2025 00:23
@jen20 jen20 reopened this Dec 30, 2025
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.

1 participant