-
Notifications
You must be signed in to change notification settings - Fork 108
"unimplemented!" encode/decode implementations for wasm #190
base: master
Are you sure you want to change the base?
Conversation
This implementation is wrong. If you use the emscripten target, this now compiles in both the unix implementation and the unknown implementation. |
Also, can we get this merged? At the moment the num crate doesn't compile because of rustc-serialize not compiling. Not sure why they still use it, but I guess they can't switch to serde before the next major version. |
I was unaware that emscripten sets the "unix"-cfg; is there any way to have an "else" part in the cfg variations to do this cleaner, or should I rephrase the non-implementation to be |
You can't do else afaik, so you could either do the not(any(...)) or specify wasm32, not emscripten. |
We'd like this merged too, and rand version bumped 0.4, which had a wasm fix in rust-random/rand#197. |
The cfg() guards around the encode/decode implementations result in the crate being unusable on wasm32-unknown-unknown or any non-unix non-windows non-redox target. These lines mark the functionality as unimplemented on those platforms (which is a sane behavior for platforms like wasm or bare-metal microprocessors given those have no file system), which makes the crate as a whole usable again for file system unrelated tasks like encoding using the "cbor" crate.
Updated the commit to reflect CryZe's findings about wasm-emscripten; tested under unix and wasm32-unknown-unknown. |
Rust recently added CloudABI support, and this will cause |
The CI fails to compile this because the latest rand doesn't compile on 1.0 anymore. So this PR itself compiles just fine. It'd be nice if someone could tell us what we should do about this (maybe just remove the 1.0 compilation?) or just merge the PR regardless. |
@kennytm well that didn't compile before at all then. But I guess we can fix it in this PR too. |
Instead of removing 1.0.0, better just restrict the [dev-dependencies]
rand = ">=0.3.0, <=0.3.20" (Note: I haven't checked which |
May I ask that we keep unrelated issues (like rand versions) in their own issue? I'm happy to address regressions this issue introduces, but |
Is there a way to get this moving somehow? |
@alexcrichton is there a way to get this PR moving again? From what I understand it seems critical to getting a lot of Rust projects that still depend on rustc-serialize into wasm. Obviously the best solution would be to switch projects to serde, but this seems like a good stopgap for cases where that's unfeasible. |
This library is currently unmaintained and not publishing new releases, so there is currently not process or timeline for publishing this. Crates depending on rustc-serialize which also want to support new platforms will need to update to a serialization framework like Serde |
@alexcrichton There's still a lot of ecosystem critical libraries like num that still depend on rustc-serialize for semver reasons. So I think a new release for this makes sense. If there's no maintainer here willing to merge and publish this, would it make sense to give someone like tomaka the rights to just push this real quick? This doesn't seem like it would take a lot of effort and affects the new wasm target a lot. |
Is it possible to get this going? Many community packages are depending on this. |
Please fix this. |
The README states:
This PR looks to me like a bug fix and one that really affects the experience of targeting WASM from Rust.
This is an option for crate maintainers, but not users of those crates (which may no longer be maintained). |
Why don't we make the implementation that's currently used for redox work for |
Filed #195 with the same |
The cfg() guards around the encode/decode implementations result in the
crate being unusable on wasm32-unknown-unknown.
These lines don't implement the functionality for that platform (there
is file system equivalent there), which makes the crate usable again for
file system unrelated tasks like encoding using the "cbor" crate.