Skip to content

cleanup(internal/sidekick/rust): qualify FromProto calls - #7909

Merged
suzmue merged 1 commit into
googleapis:mainfrom
suzmue:qualify-fromproto
Nov 9, 2026
Merged

suzmue merged 1 commit into
googleapis:mainfrom
suzmue:qualify-fromproto

Conversation

@suzmue

@suzmue suzmue commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Generated FromProto impls, and the LRO Any conversion in the gRPC transport, passed v.cnv() to functions generic over Into, so the target type was only inferred when the prost type had exactly one FromProto impl. Adding a second impl for a shared prost type, such as prost_types::Timestamp, in gax-internal can brake generated gRPC crates.

Call gaxi::prost::FromProto::::cnv explicitly. Boxed recursive fields now dereference the box first, and enum fields (i32 in prost) convert with the enum's From impl, matching the existing repeated enum branch.

For googleapis/google-cloud-rust#7284

Generated FromProto impls, and the LRO Any conversion in the gRPC
transport, passed v.cnv() to functions generic over Into<FieldType>, so
the target type was only inferred when the prost type had exactly one
FromProto impl. Adding a second impl for a shared prost type, such as
prost_types::Timestamp, in gax-internal broke generated gRPC crates
with E0283 (67 sites in google-cloud-storage alone).

Call gaxi::prost::FromProto::<FieldType>::cnv explicitly. Boxed
recursive fields now dereference the box first, and enum fields (i32
in prost) convert with the enum's From<i32> impl, matching the
existing repeated enum branch.

For googleapis/google-cloud-rust#7284
@suzmue
suzmue requested a review from a team as a code owner November 9, 2026 22:54

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Rust code generation templates and tests to use explicit type-qualified FromProto trait method calls (e.g., FromProto::<T>::cnv) instead of calling the .cnv() method directly. This change affects messages, maps, oneofs, and LRO conversions, ensuring more robust type resolution during compilation. Additionally, new test cases are added to verify the conversion of messages with optional enums and enum-valued maps. There are no review comments to address, and I have no further feedback to provide.

@suzmue

suzmue commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Changes with regeneration: googleapis/google-cloud-rust@2dcced8...413da7a

@suzmue
suzmue merged commit 2acbf75 into googleapis:main Nov 9, 2026
47 of 48 checks passed
@suzmue
suzmue deleted the qualify-fromproto branch November 10, 2026 17:03
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