Skip to content

codegen: route bytes_fields paths through ::buffa::bytes:: re-export#77

Merged
iainmcgin merged 2 commits intomainfrom
chore/bytes-reexport-sweep
Apr 28, 2026
Merged

codegen: route bytes_fields paths through ::buffa::bytes:: re-export#77
iainmcgin merged 2 commits intomainfrom
chore/bytes-reexport-sweep

Conversation

@iainmcgin
Copy link
Copy Markdown
Collaborator

Part of #76.

Generated code referenced ::bytes::Bytes directly at 12 sites, all gated on the bytes_fields config option. That requires every consumer enabling bytes_fields to add bytes as a direct Cargo dependency, even though buffa re-exports it (pub use ::bytes;). This routes those sites through ::buffa::bytes::Bytes instead — same convention as ::buffa::bytes::BufMut, ::buffa::alloc::*, and ::buffa::__private::* elsewhere in emitted code.

Mechanical s/::bytes::Bytes/::buffa::bytes::Bytes/ across impl_message.rs (5), impl_text.rs (3), message.rs (2), oneof.rs (1 + 1 doc-comment), view.rs (1). The codegen_integration snapshot assertion that spanned the Bytes::from( open-paren was loosened since the longer path now triggers prettyplease line-wrap there. WKT regen only touches Any (the only WKT with a bytes_fields entry).

The unconditional case (#74's to_owned_from_source signature) is independent of this and lands separately; this PR has a trivial 1-line overlap in view.rs:61 that whichever merges second will absorb.

Audit also confirmed: ::serde:: / ::serde_json:: / ::arbitrary:: direct paths are by design (documented consumer-side deps for generate_json / generate_arbitrary); ::alloc:: / ::std:: / ::hashbrown:: / ::once_cell:: have zero non-prefixed emissions.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 28, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

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.
@iainmcgin iainmcgin force-pushed the chore/bytes-reexport-sweep branch from 6e5b8c5 to 67e54b6 Compare April 28, 2026 19:05
@iainmcgin iainmcgin requested a review from kollektiv April 28, 2026 19:47
@iainmcgin iainmcgin enabled auto-merge (squash) April 28, 2026 20:30
@iainmcgin iainmcgin merged commit 77592e4 into main Apr 28, 2026
7 checks passed
@iainmcgin iainmcgin deleted the chore/bytes-reexport-sweep branch April 28, 2026 20:32
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants