Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Remove async-trait #5812

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kayabaNerve
Copy link
Contributor

@kayabaNerve kayabaNerve commented Jan 13, 2025

Description

Removes async-trait for usage of RPIT.

Notes & open questions

libp2p's MSRV has included RPIT for a while now, making this possible. The Send bounds follow the behavior from async-trait. async-trait's generation of Pin<Box<dyn Future>> also provided Unpin which has not been a preserved bound EXCEPT in the test code which required it in in-tree call sites. Moving forward, callers expecting Unpin should wrap their futures themselves with Box::pin.

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

libp2p's MSRV has included RPIT for a while now, making this possible. The
`Send` bounds follow the behavior from async-trait. async-trait's generation of
`Pin<Box<dyn Future>>` also provided `Unpin` which has *not* been a preserved
bound EXCEPT in the test code which required it in in-tree call sites. Moving
forward, callers expecting `Unpin` should wrap their futures themselves with
`Box::pin`.
@kayabaNerve
Copy link
Contributor Author

kayabaNerve commented Jan 13, 2025

libp2p-request-response already has an unpublished breaking change release in-tree. Most of the modified crates solely had their libp2p-request-response integrations edited, and already had a CHANGELOG entry for their update to the latest version.

libp2p-dns is weird. It has a hidden, public API item I did make breaking changes to and did not already have an unpublished breaking change in release (solely a patch release). It doesn't need a breaking change release if the hidden API entry is considered NOT part of the public API. I assumed that yes, there would be issues to change it without a new release however (as it has no in-tree users so it presumably services out-of-tree crates), and did bump the minor version. If these changes are an area of contest, they can be moved to a distinct PR as the libp2p-request-response changes are my priority.

No documentation/tests were needed for this, hence the unchecked boxes in the checklist.

It'd be great to have this included prior to the new releases which are about to occur. Sorry if it's too last minute.

@kayabaNerve kayabaNerve changed the title Remove async-trait chore: Remove async-trait Jan 13, 2025
@elenaf9
Copy link
Contributor

elenaf9 commented Jan 14, 2025

Hi @kayabaNerve, thank you for the PR!

Could you share a bit about the motivation for removing the use of async-trait?

It'd be great to have this included prior to the new releases which are about to occur. Sorry if it's too last minute.

We are planning to release today, so unfortunately it's a bit too short notice. If it's very urgent we could cut another release soon-ish, but it be great to know why.

@kayabaNerve
Copy link
Contributor Author

It's an unnecessary dependency with worse codegen? It only existed because RPIT wasn't stable and RPIT has been stable for months now. libp2p's MSRV includes RPIT as well, so there really is no blocker.

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