refactor: remove internal Captures workaround trait#1383
Merged
Conversation
`wrpc-transport` carried a `#[doc(hidden)] Captures<'a>` marker trait as a workaround for rust-lang/rust#63033, used to force returned `impl Future`s to capture an otherwise-unused lifetime. Precise capturing (`use<..>`, stable since Rust 1.82) makes it unnecessary. Drop the trait and its uses: - transport: remove the trait/impl and the `serve` test bounds (edition 2024 captures the elided lifetime by default). - rust bindgen: replace `+ Captures<'a>` on generated `serve`/`serve_interface` futures with `+ use<'a, T, H>`, turning the argument-position `impl Handler` into a named generic so it can be named in the `use<..>` bound; the nested deferred futures now use `+ use<'a, C__>`. Generated bindings continue to compile under both edition 2021 and 2024. Assisted-by: claude:claude-opus-4-8
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
wrpc-transportcarried a#[doc(hidden)] Captures<'a>marker trait as a workaround for rust-lang/rust#63033, used to force returnedimpl Futures to capture an otherwise-unused lifetime. Precise capturing (use<..>, stable since Rust 1.82) makes it unnecessary.Drop the trait and its uses:
servetest bounds (edition 2024 captures the elided lifetime by default).+ Captures<'a>on generatedserve/serve_interfacefutures with+ use<'a, T, H>, turning the argument-positionimpl Handlerinto a named generic so it can be named in theuse<..>bound; the nested deferred futures now use+ use<'a, C__>.Generated bindings continue to compile under both edition 2021 and 2024.
Assisted-by: claude:claude-opus-4-8