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

Add 'project_into' method to #[pin_project] types #69

Merged
merged 2 commits into from
Sep 4, 2019

Conversation

Aaron1011
Copy link
Collaborator

This method consumes takes a 'Pin<&mut Self>' by value, instead
of by mutable reference. This allows us to give the projection
struct/enum a longer lifetime, which is required when returning it
from a function

Fixes #65

This method consumes takes a 'Pin<&mut Self>' by value, instead
of by mutable reference. This allows us to give the projection
struct/enum a longer lifetime, which is required when returning it
from a function

Fixes taiki-e#65
@taiki-e
Copy link
Owner

taiki-e commented Sep 4, 2019

I was thinking of changing the argument type back to self: Pin<&mut Self> (8735be8), but this seems to be fine considering that there are probably not many use cases like #65.

@taiki-e
Copy link
Owner

taiki-e commented Sep 4, 2019

@Aaron1011 Thanks for all of your work on this!

bors r+

bors bot added a commit that referenced this pull request Sep 4, 2019
69: Add 'project_into' method to #[pin_project] types r=taiki-e a=Aaron1011

This method consumes takes a 'Pin<&mut Self>' by value, instead
of by mutable reference. This allows us to give the projection
struct/enum a longer lifetime, which is required when returning it
from a function

Fixes #65

Co-authored-by: Aaron Hill <[email protected]>
Co-authored-by: Taiki Endo <[email protected]>
@bors
Copy link
Contributor

bors bot commented Sep 4, 2019

Build succeeded

  • taiki-e.pin-project

@bors bors bot merged commit e04660c into taiki-e:master Sep 4, 2019
@taiki-e taiki-e added this to the v0.4 milestone Sep 4, 2019
///
/// ```ignore
/// fn project(&mut Pin<&mut Self>) -> ProjectedType;
/// fn project_into(Pin<&mut Self>) -> ProjectedType;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think project should take Pin<&mut Self>, the double ptr-indirection looks very strange. The argument for why it has been added is incorrect I think, see what I wrote at #47 (comment).

@taiki-e taiki-e added the A-pin-projection Area: #[pin_project] label Sep 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-pin-projection Area: #[pin_project]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression: cannot return value referencing function parameter self
3 participants