BurntSushi / BurntSushi/quickcheck

Add support for emscripten (wasm32-unknown-emscripten target)

Open
#272 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2.8k
Forks
165
PR merge metrics
No merged PRs in 30d

Description

I'm unable to build `quickcheck` when targeting the `wasm32-unknown-emscripten` build target.
Please consider adding support for wasm as a 1st class citizen!

Repro:
Using `master` at `defde6fb0ce20b0c8c4e672aa9ae821f7d1f5b38`,
Perform the following steps:
1. Setup: add the wasm-emscripten target by running `rustup target add wasm32-unknown-emscripten`
2. Attempt to build `quickcheck` for this target using `cargo build --target wasm32-unknown-emscripten`

Expected result:
`quickcheck` is successfully built for the wasm target

Actual result:
Compilation fails with the following message:
```
error[E0277]: the trait bound `Standard: Distribution` is not satisfied
--> src\arbitrary.rs:785:32
|
785 | _ => g.gen()
| ^^^ the trait `Distribution` is not implemented for `Standard`
...
797 | / unsigned_arbitrary! {
798 | | usize, u8, u16, u32, u64, u128
799 | | }
| |_- in this macro invocation
|
= help: the following implementations were found:
>
>
>
>
and 63 others
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
```

Notes:
- Notice that `rand` disabled support for `i128` and `u128` when targeting emscripten, due to emscripten limitations (see: https://github.com/rust-random/rand/pull/671 ). Perhaps `quickcheck` should also exclude support for these types when targeting emscripten?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in src/arbitrary.rs around lines 785-799, where the unsigned arbitrary macro includes u128, and compare this with rand’s emscripten limitation noted in the issue. Reproduce with rustup target add wasm32-unknown-emscripten and cargo build --target wasm32-unknown-emscripten. Done means quickcheck builds successfully for the wasm32-unknown-emscripten target.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
build-system, testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.