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

Replace pin-project by pin-project-lite #1185

Merged
merged 5 commits into from
Jul 18, 2021

Conversation

jplatte
Copy link
Member

@jplatte jplatte commented Jan 12, 2021

Motivation

pin-project-lite, in contrast to pin-project, does not depend on syn and quote and as such is much lighter on compile times. futures-rs switched recently, see that PR for compile time differences.

Solution

Replace pin-project by pin-project-lite.

Resolves #1178.

@jplatte
Copy link
Member Author

jplatte commented Jan 12, 2021

CI failure seems unrelated.

@jplatte jplatte changed the title futures: Replace pin-project by pin-project-lite Replace pin-project by pin-project-lite Jan 12, 2021
@jplatte
Copy link
Member Author

jplatte commented Jan 12, 2021

I've added a commit to appease clippy, let me know if you'd rather keep that out of this PR.

@jplatte
Copy link
Member Author

jplatte commented Jan 12, 2021

Now there's a bunch more clippy warnings that I'm not as comfortable addressing.

@djc
Copy link
Contributor

djc commented Jan 22, 2021

This looks good to me, would be nice to have.

@hawkw
Copy link
Member

hawkw commented Feb 5, 2021

I'm a bit on the fence about whether or not to merge this in light of the discussion on #1185, e.g. #1178 (comment)

@taiki-e, as the maintainer of both pin-project and pin-project-lite, what would you recommend? I'll note that tracing already uses pin-project-lite rather than pin-project.

Another advantage of pin-project, IMO, that wasn't discussed in #1185, is that it has a 1.0 release, while pin-project-lite does not. If breaking changes of pin-project are much less likely than pin-project-lite, we won't have to release tracing-futures patches just to bump the pin-project dependency nearly as often — and it reduces the potential for multiple pin-project versions in users' dependency trees.

I could be convinced either way, though.

@taiki-e
Copy link
Member

taiki-e commented Feb 13, 2021

as the maintainer of both pin-project and pin-project-lite, what would you recommend? I'll note that tracing already uses pin-project-lite rather than pin-project.

If you are already using pin-project-lite in the same workspace, there is basically no reason to oppose this patch.
(However, note that a patch that recently tried to do the same with hyper caused a regression due to the pin-project-lite's limitation was missed. hyperium/hyper#2422)

Another advantage of pin-project, IMO, that wasn't discussed in #1185, is that it has a 1.0 release, while pin-project-lite does not. If breaking changes of pin-project are much less likely than pin-project-lite, we won't have to release tracing-futures patches just to bump the pin-project dependency nearly as often — and it reduces the potential for multiple pin-project versions in users' dependency trees.

As for pin-project-lite, 0.3 release may be needed soon. (Using pin-project-lite in core crate requires breaking changes.)
As for pin-project, 2.0 will not be released unless a year has passed since GAT was stable. (Actually, I think we can support GAT as an option, so breaking changes are not always necessary.)
That said, pin-project-lite is very light, so I don't think multiple pin-project-lite versions in dependency trees will have an impact on compile time.

@hawkw hawkw requested a review from davidbarsky as a code owner June 4, 2021 18:50
@jplatte
Copy link
Member Author

jplatte commented Jul 16, 2021

Bump!

Hyper has now been on pin-project-lite for a while after the initial regression was fixed (hyperium/hyper#2566). Otherwise nothing has changed AFAIK.

Copy link
Member

@davidbarsky davidbarsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay—if Hyper switched over, might as well switch over here.

@davidbarsky
Copy link
Member

I'll merge once CI passes.

@davidbarsky davidbarsky merged commit ce85373 into tokio-rs:master Jul 18, 2021
@jplatte jplatte deleted the pin-project-lite branch July 18, 2021 21:19
hawkw added a commit that referenced this pull request Aug 17, 2021
* futures: Replace pin-project by pin-project-lite
* tower: Replace pin-project by pin-project-lite

Co-authored-by: Eliza Weisman <eliza@buoyant.io>
Co-authored-by: David Barsky <me@davidbarsky.com>
hawkw added a commit that referenced this pull request Aug 17, 2021
* futures: Replace pin-project by pin-project-lite
* tower: Replace pin-project by pin-project-lite

Co-authored-by: Eliza Weisman <eliza@buoyant.io>
Co-authored-by: David Barsky <me@davidbarsky.com>
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.

Consider switching from pin-project to pin-project-lite
5 participants