Skip to content

remote-derive: avoid lifetime parameter collisions - #656

Closed
fallintoplace wants to merge 1 commit into
anthropics:mainfrom
fallintoplace:fix/remote-derive-lifetime-collisions
Closed

fallintoplace wants to merge 1 commit into
anthropics:mainfrom
fallintoplace:fix/remote-derive-lifetime-collisions

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

What

  • Avoid lifetime name collisions in generated serde and arbitrary impls.

Why

  • Newtypes using those lifetime names failed to compile.

Implementation

  • Choose an unused name from the newtype generics, bounds, and wrapped type.
  • Add coverage for declared and higher-ranked lifetimes.

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

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

@iainmcgin

Copy link
Copy Markdown
Collaborator

[claude code] Thank you for the PR. We are closing this one and keeping the reservation.

The __buffa and __Buffa prefixes are documented as reserved for the derive output (the "Reserved identifiers" section of the buffa-remote-derive crate docs), so a user lifetime named __buffa_de is outside what the derives support. This PR makes two of the generated names collision-proof (the __buffa_de and __buffa_arb lifetimes). The __buffa_iter lifetime and the generated type parameters (__BuffaIter, __BuffaSerializer, __BuffaDeserializer, __BuffaValue, __BuffaError, __BuffaVisitor) would still collide, and the docs section would then forbid something that partly works. The defect a user can hit without touching the reserved prefix, the unprefixed value bindings from #652, is fixed by #693.

The token scan itself is sound. Lifting the reservation entirely would mean covering every generated lifetime and type parameter plus the docs section; if you want to pursue that, please open an issue first so we can settle whether the reservation should go.

@iainmcgin iainmcgin closed this Oct 12, 2026
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