codegen: route bytes_fields paths through ::buffa::bytes:: re-export#77
Merged
codegen: route bytes_fields paths through ::buffa::bytes:: re-export#77
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
4 tasks
Generated code referenced ::bytes::Bytes directly at 12 sites (all gated on bytes_fields), requiring consumers to add `bytes` as a direct dep. Route through buffa's re-export instead, matching ::buffa::bytes::BufMut and ::buffa::alloc:: elsewhere. Mechanical s/::bytes::Bytes/::buffa::bytes::Bytes/. Part of #76.
6e5b8c5 to
67e54b6
Compare
kollektiv
approved these changes
Apr 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #76.
Generated code referenced
::bytes::Bytesdirectly at 12 sites, all gated on thebytes_fieldsconfig option. That requires every consumer enablingbytes_fieldsto addbytesas a direct Cargo dependency, even thoughbuffare-exports it (pub use ::bytes;). This routes those sites through::buffa::bytes::Bytesinstead — same convention as::buffa::bytes::BufMut,::buffa::alloc::*, and::buffa::__private::*elsewhere in emitted code.Mechanical
s/::bytes::Bytes/::buffa::bytes::Bytes/acrossimpl_message.rs(5),impl_text.rs(3),message.rs(2),oneof.rs(1 + 1 doc-comment),view.rs(1). Thecodegen_integrationsnapshot assertion that spanned theBytes::from(open-paren was loosened since the longer path now triggers prettyplease line-wrap there. WKT regen only touchesAny(the only WKT with abytes_fieldsentry).The unconditional case (#74's
to_owned_from_sourcesignature) is independent of this and lands separately; this PR has a trivial 1-line overlap inview.rs:61that whichever merges second will absorb.Audit also confirmed:
::serde::/::serde_json::/::arbitrary::direct paths are by design (documented consumer-side deps forgenerate_json/generate_arbitrary);::alloc::/::std::/::hashbrown::/::once_cell::have zero non-prefixed emissions.