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

Implement !Unpin option #219

Merged
merged 3 commits into from May 9, 2020
Merged

Implement !Unpin option #219

merged 3 commits into from May 9, 2020

Conversation

taiki-e
Copy link
Owner

@taiki-e taiki-e commented May 9, 2020

Example

#[pin_project(!Unpin)]
struct Struct<T, U> {
    #[pin]
    pinned: T,
    unpinned: U,
}

Also, bump MSRV to 1.34 because unrestricted_attribute_tokens requires 1.34 (#202 also requires 1.34).

Closes #108

@taiki-e taiki-e added the A-unpin Area: Unpin and UnsafeUnpin label May 9, 2020
@taiki-e taiki-e force-pushed the no-unpin branch 6 times, most recently from 9ec67a4 to 2706e39 Compare May 9, 2020 08:20
@taiki-e taiki-e force-pushed the no-unpin branch 5 times, most recently from 637a13d to bdcfbf8 Compare May 9, 2020 11:14
@taiki-e taiki-e added C-enhancement Category: A new feature or an improvement for an existing one relnotes labels May 9, 2020
unrestricted_attribute_tokens requires 1.34
Copy link
Owner Author

@taiki-e taiki-e left a comment

Choose a reason for hiding this comment

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

It's been more than a year since 1.34 was released, and most of the users of this crate depend on futures_api that requires 1.36 (and many of them depend on async_await that requires 1.39). so bumping MSRV to 1.34 is probably no problem.

(Also, the old receiver lifetime elision rule is not convenient, so I guess very few people really want to use pin in those versions...)

bors r+

@bors
Copy link
Contributor

bors bot commented May 9, 2020

Build succeeded:

@bors bors bot merged commit 7824db7 into master May 9, 2020
@bors bors bot deleted the no-unpin branch May 9, 2020 12:08
@taiki-e taiki-e mentioned this pull request May 9, 2020
4 tasks
@taiki-e
Copy link
Owner Author

taiki-e commented May 9, 2020

It's been more than a year since 1.34 was released, and most of the users of this crate depend on futures_api that requires 1.36 (and many of them depend on async_await that requires 1.39). so bumping MSRV to 1.34 is probably no problem.

I think we need to decide on a policy when we release 1.0, but for now, I would like to support a year ago rustc (as long as it is possible).

bors bot added a commit that referenced this pull request May 18, 2020
202: Allow naming the projected types r=taiki-e a=taiki-e

By passing an argument with the same name as the method to the attribute, you can name the projection type returned from the method:

```rust
#[pin_project(
    Replace,
    project = StructProj,
    project_ref = StructProjRef,
    project_replace = StructProjOwn,
)]
struct Struct<T> {
    #[pin]
    field: T,
}

let mut x = Struct { field: 0 };
let StructProj { field } = Pin::new(&mut x).project();
let StructProjRef { field } = Pin::new(&x).project_ref();
let StructProjOwn { field } = Pin::new(&mut x).project_replace(Struct { field: 1 });
```

cc #43
Closes #124

TODO: 
  * [x] add tests
  * [x] write docs 
  * [x] separate unrelated changes; done in #214
  * [x] msrv (`unrestricted_attribute_tokens` requires 1.34); done in #219 


Co-authored-by: Taiki Endo <te316e89@gmail.com>
This was referenced Oct 5, 2020
bors bot added a commit that referenced this pull request Oct 5, 2020
292: Bump MSRV to 1.37 r=taiki-e a=taiki-e

Bumps MSRV to 1.37 because `underscore_const_names` requires 1.37. This allows removing the build script.

It's been more than a year since [1.37 was released](https://blog.rust-lang.org/2019/08/15/Rust-1.37.0.html), and most of the users of this crate depend on `futures_api` that requires 1.36 and `async_await` that requires 1.39. so bumping MSRV to 1.37 is probably no problem.
Also, given that pin-project-lite's MSRV is 1.37 and the possibility of switching, most futures-related utilities require at least 1.37.

cc #264
Refs: #219

Co-authored-by: Taiki Endo <te316e89@gmail.com>
@taiki-e taiki-e removed the C-enhancement Category: A new feature or an improvement for an existing one label Jan 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-unpin Area: Unpin and UnsafeUnpin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide a way to guarantee the type is !Unpin
1 participant