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

[WIP] Add the pin_project attribute #12

Closed
wants to merge 1 commit into from
Closed

[WIP] Add the pin_project attribute #12

wants to merge 1 commit into from

Conversation

taiki-e
Copy link
Owner

@taiki-e taiki-e commented May 14, 2019

Add a new attribute macro. This works as follows:

#[pin_project(self)]
fn foo(mut self: Pin<&mut Self>) {
    let x: Pin<&mut i32> = self.field1;
    let y: &mut i32 = self.field2;
}

// desugaring
fn foo(self: Pin<&mut Self>) {
    let mut __self = self.project();
    let x: Pin<&mut i32> = __self.field1;
    let y: &mut i32 = __self.field2;
}

TODO: write docs

@taiki-e
Copy link
Owner Author

taiki-e commented Aug 6, 2019

I don't plan to put this feature in the next version. In the next version, we will stick to making pin-project safer.

@taiki-e taiki-e closed this Aug 6, 2019
@taiki-e taiki-e deleted the pin_project branch August 6, 2019 23:47
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.

1 participant