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

Migrate to pin project lite #595

Merged

Conversation

Michael-J-Ward
Copy link
Contributor

@Michael-J-Ward Michael-J-Ward commented Jul 24, 2021

Clears out the easy parts of #594.

Remaining:

  • util::Either - it is public and the migration requires a breaking change (as described here)
  • buffer::worker - would love to take a shot at the refactor with a little more guidance.

Note: the doc comment on AsyncResponseFuture::service was also reduced to a regular comment.

This is a known limitation of pin_project_lite that the they have labeled as "help wanted".
taiki-e/pin-project-lite#3 (comment)
pin_project_lite has the current limitation of nto supporting doc comments
taiki-e/pin-project-lite#3 (comment)

pin_project_lite does not and will not support tuple variants
https://github.com/taiki-e/pin-project-lite/blob/416be96f7777862c68b567c92a91887f69a8c2b3/src/lib.rs#L401-L408
peak_wma and pending_requests will now properly compile without the "discover" feature enabled.
@Michael-J-Ward
Copy link
Contributor Author

Running the tests on both stable and nightly pass locally for me. On nightly, I do receive multiple warnings about a lint renaming.

I'd appreciate any advice on how to diagnose further.

On Stable

$ rustc --version
rustc 1.53.0 (53cb7b09b 2021-06-17)
$ cargo test --all --all-features
(passes)

On Nightly

$ rustc +nightly --version
rustc 1.56.0-nightly (08095fc1f 2021-07-26)
$ cargo +nightly test --all --all-features
(passes)

The lint rename warning

  |
8 | #![deny(broken_intra_doc_links)]
  |         ^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `rustdoc::broken_intra_doc_links`
  |
  = note: `#[warn(renamed_and_removed_lints)]` on by default

@LucioFranco
Copy link
Member

@Michael-J-Ward are you able to rename it? or is it not available on stable yet?

broken_intra_doc_links has been renamed to rustdoc::broken_intra_doc_links
@Michael-J-Ward
Copy link
Contributor Author

I should have been clearer- the lint warning was not the reason for the failure. This test below is failing in CI but I can't trigger the failure locally.

     Running tests/spawn_ready/main.rs (target/debug/deps/spawn_ready-102042b79d40a5b4)

running 4 tests
test propagates_trace_spans ... ok
test abort_on_drop ... FAILED
test when_inner_is_not_ready ... ok
test when_inner_fails ... ok

failures:

---- abort_on_drop stdout ----
thread 'abort_on_drop' panicked at 'pending', tower/tests/spawn_ready/main.rs:84:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    abort_on_drop

test result: FAILED. 3 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

error: test failed, to rerun pass '-p tower --test spawn_ready'
Error: The process '/usr/share/rust/.cargo/bin/cargo' failed with exit code 101

@LucioFranco
Copy link
Member

@taiki-e are there any differences in drop behavior between pin project and pin project lite?

pin_project_lite does support PinnedDrop
https://github.com/taiki-e/pin-project-lite/pull/25/files

However, it does not support generic trait bounds on the PinnedDrop impl.

To workaround this, I removed the T::Error bound from the Worker struct definition,
and moved `close_semaphore` to a a new impl without that trait bound.
@taiki-e
Copy link
Contributor

taiki-e commented Jul 27, 2021

are there any differences in drop behavior between pin project and pin project lite?

I don't think so.

@Michael-J-Ward
Copy link
Contributor Author

After updating cargo and disabling / clearing out sccache, I am able to reproduce the abort_on_drop error locally.

However, abort_on_drop now also fails for me on master, so it's not pin_project_lite related, @taiki-e

@Michael-J-Ward Michael-J-Ward changed the title [WIP] Migrate to pin project lite Migrate to pin project lite Jul 27, 2021
@LucioFranco LucioFranco merged commit ee131aa into tower-rs:master Jul 28, 2021
davidpdrsn added a commit that referenced this pull request Oct 13, 2021
- Migrate to pin-project-lite ([#595])
- **builder**: Implement `Layer` for `ServiceBuilder` ([#600])
- **builder**: Add `ServiceBuilder::and_then` analogous to
  `ServiceExt::and_then` ([#601])

[#600]: #600
[#601]: #601
[#595]: #595
[pin-project-lite]: https://crates.io/crates/pin-project-lite
davidpdrsn added a commit that referenced this pull request Oct 14, 2021
- Migrate to pin-project-lite ([#595])
- **builder**: Implement `Layer` for `ServiceBuilder` ([#600])
- **builder**: Add `ServiceBuilder::and_then` analogous to
  `ServiceExt::and_then` ([#601])

[#600]: #600
[#601]: #601
[#595]: #595
[pin-project-lite]: https://crates.io/crates/pin-project-lite
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.

None yet

3 participants