Closed andrzejressel closed 1 week ago
I encountered this issue as well. AFAICT the problem is this change in the hyper 1.0
upgrade PR:
- tokio-stream = "0.1"
+ h2 = {version = "0.4", optional = true}
+ hyper = {version = "1", features = ["full"], optional = true}
+ hyper-util = { version = ">=0.1.4, <0.2", features = ["full"], optional = true }
+ hyper-timeout = {version = "0.5", optional = true}
+ socket2 = { version = ">=0.4.7, <0.6.0", optional = true, features = ["all"] }
+ tokio = {version = "1", default-features = false, optional = true}
+ tokio-stream = { version = "0.1", features = ["net"] }
tokio-stream
has always been a required dependency, and tokio
is a required dependency of tokio-stream
. But the only feature flag that was enabled was tokio/sync
which works fine on WASM. However, tokio-stream/net
enables tokio/net
, and tonic 0.12
now requires tokio-stream/net
.
It would be good to know whether tokio-stream/net
is actually required at all times, or if it is only needed for the transport
feature flag. I note that tokio-stream
itself is listed under the section of dependencies for the transport
feature flag, so maybe it has always only been used by that feature and just wasn't made optional? If it turns out that tokio/net
is now required for tonic
without feature flags, then that is an undocumented breaking change.
It appears this was already fixed with https://github.com/hyperium/tonic/pull/1795.
On a wasm32-unknown-unknown
project (which should behave the same as wasm32-wasi
for the purposes of this issue) that has tonic = {version = "0.12", default-features = false, features = ["codegen", "prost"]}
we had a similar problem trying to upgrade from 0.11 to 0.12.
Patching our dependencies to install from git with the above change included, using (in Cargo.toml
):
[patch.crates-io]
tonic = { git = "https://github.com/hyperium/tonic.git", rev = "v0.12.0-12-gaa57ffe" }
...removes the offending tokio/mio dependencies and successfully compiles again.
(Ping @tottoto / @djc as an FYI in case this warrants more explicit calling out in future release notes and/or is worthy of an expedited 0.12.1 patch release)
@zoni thanks for the ping! Doing a release for this probably makes sense. @LucioFranco can you take care of that? Maybe now is a good time to document the release process enough that others can also do it?
v0.12.1 has been released.
Bug Report
Version
0.12.0
Platform
WASM
Crates
tonic
Description
Cargo.toml
rust-toolchain.toml
Compiling for WASM with version "0.11.0" works fine
But version 0.12.0 returns error