Fix emscripten build failures due to lack of i128 support #281
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Bincode only partially relies on whether
serde
decides to enablei128
. And so, buildingbincode
for Emscripten targets is totally broken onrustc
>= 1.26.0.Solution
Remove
autocfg
and simply rely onserde
to determine whether i128 is supportedBackground
autocfg
checks fori128
support by attempting to compile code to llvm-ir and checking for success or failure. When targeting Emscripten,i128
can still be compiled to llvm-ir and soautocfg
believesi128
support should be enabled. Unfortunately, the Emscripten runtime does not supporti128
despite the LLVM backend supporting it and so it needs to be explicitly disabled. This is the route thatserde
takes here: https://github.com/serde-rs/serde/blob/master/serde/build.rs#L56Since serde does not add the
deserialize_u128
method to theserde::Deserializer
trait for Emscripten targets, butautocfg
believes that 128bit integers are supported and implements the method, I'm seeing this build error:Full CI Failure here: https://travis-ci.com/yewstack/yew/jobs/247388659#L541