Tonic: Upgrade to stable futures 0.3

Created on 14 Nov 2019  路  5Comments  路  Source: hyperium/tonic

Feature Request

Motivation

Currently, Tonic is not semver compatible with stable upstream futures >= 0.3.0 because the manifest pins the version to futures-core-preview = "=0.3.0-alpha.19". This means that conversion traits such as IntoRequest and IntoStreamingRequest do not work as expected in projects that depend on upstream futures 0.3.1, which results in confusing and misleading compiler error messages. For example:

  --> my-project/src/foo.rs:38:45
   |
38 |         let response = self.0.send_progress(stream).await?;
   |                                             ^^^^^^ the trait `futures_core::stream::Stream` is not implemented for `S`
   |
   = help: consider adding a `where S: futures_core::stream::Stream` bound
   = note: required because of the requirements on the impl of `tonic::request::IntoStreamingRequest` for `S`

This is despite the fact that the type parameter S already has a valid Stream<Item = MyRequest> bound in the code.

Proposal

Fixing this should be as simple as replacing dependencies on the unstable futures-core-preview and futures-util-preview crates with the stable futures-core and futures-util crates and releasing a new version of Tonic on Crates.io.

Unfortunately, we seem to be blocked on Hyper, which also depends on a version-pinned futures-preview crate instead of the stable futures crate (hyperium/hyper#2013). That project will need to be updated first before Tonic itself can be updated.

Alternatives

None that I can consider. Since futures 0.3 is now out of alpha, Tonic should make use of it to allow the ecosystem to move forward.

Most helpful comment

@ebkalderon yeah we should update, we should also move to a git version of hyper and tokio while everything upgrade but I am catuious about breaking things. Next tokio release should be next week so I'll follow up then. Sorry about things being a bit in flux :(

All 5 comments

@ebkalderon yeah we should update, we should also move to a git version of hyper and tokio while everything upgrade but I am catuious about breaking things. Next tokio release should be next week so I'll follow up then. Sorry about things being a bit in flux :(

Any update on when this will happen?

Yes, I am actively working on this right now. We have a couple of blockers. I am hoping to get a release out this week but it really depends on the other deps and issues we run into.

  • #159
  • #160
  • #161
  • and hyper 0.13 release

Once, these are done I think we can get a 0.1 release out!

Thanks for the fast response!

This is done on master! #163 Thanks for the patience everyone <3

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xmclark picture xmclark  路  10Comments

mariogemoll picture mariogemoll  路  4Comments

dangerousplay picture dangerousplay  路  10Comments

cthulhua picture cthulhua  路  3Comments

jen20 picture jen20  路  6Comments