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

Remove uses of pin_project::project attribute #2176

Merged
merged 2 commits into from
Jun 9, 2020

Conversation

taiki-e
Copy link
Member

@taiki-e taiki-e commented Jun 5, 2020

pin-project will deprecate the project attribute due to some unfixable
limitations.

Refs: taiki-e/pin-project#225

Although the deprecation of the project attribute has not been released yet, this PR is submitted in advance to avoid the CI from being broken by deprecated warnings.

pin-project will deprecate the project attribute due to some unfixable
limitations.

Refs: taiki-e/pin-project#225

use crate::fns::FnOnce1;

/// Internal Map future
#[pin_project(Replace)]
#[pin_project(Replace, project = MapProj, project_replace = MapProjOwn)]
Copy link
Member Author

Choose a reason for hiding this comment

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

It is not ideal that we need to have both Replace and project_replace = <name> as project_replace = <name> implies that a project_replace method is generated.
I'll fix it soon.

Copy link
Member Author

@taiki-e taiki-e Jun 6, 2020

Choose a reason for hiding this comment

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

Fixed in pin-project 0.4.20 (taiki-e/pin-project#243)

@taiki-e taiki-e marked this pull request as draft June 6, 2020 03:42
bors bot added a commit to taiki-e/pin-project that referenced this pull request Jun 6, 2020
243: Allow `project_replace` argument to be used without `Replace` r=taiki-e a=taiki-e

Currently, both `Replace` and `project_replace = <name>` arguments are required to name the return value of `project_replace()` method.

```rust
#[pin_project(Replace, project_replace = EnumProjOwn)]
enum Enum<T> {
    Variant(#[pin] T)
}
```

It is not ideal that we need to have both `Replace` and `project_replace = <name>` as `project_replace = <name>` implies that a `project_replace` method is generated.

This PR makes `project_replace` argument to use without `Replace` argument.

```diff
- #[pin_project(Replace, project_replace = EnumProjOwn)]
+ #[pin_project(project_replace = EnumProjOwn)]
  enum Enum<T> {
      Variant(#[pin] T)
  }
```

Also, makes `project_replace` argument an alias for `Replace` so that it can be used without a value.


```rust
#[pin_project(project_replace)]
enum Enum<T> {
    Variant(#[pin] T)
}
```

Related: rust-lang/futures-rs#2176 (comment) hyperium/hyper#2220 (comment)

Co-authored-by: Taiki Endo <te316e89@gmail.com>
@taiki-e taiki-e marked this pull request as ready for review June 6, 2020 18:40
@Nemo157
Copy link
Member

Nemo157 commented Jun 9, 2020

Thanks! The number of PRs you've done for this deprecation is pretty epic 😁

@Nemo157 Nemo157 merged commit 19831db into rust-lang:master Jun 9, 2020
@taiki-e taiki-e deleted the pin-project branch June 9, 2020 08:49
exrook pushed a commit to exrook/futures-rs that referenced this pull request Apr 5, 2021
Remove uses of pin_project::project attribute
exrook pushed a commit to exrook/futures-rs that referenced this pull request Apr 5, 2021
Remove uses of pin_project::project attribute
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