Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update all dependencies (incl JS) and make use of thread_local #12

Merged
merged 14 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Setup nightly Rust
run: rustup toolchain install nightly-2022-12-12 --profile minimal --target wasm32-unknown-unknown --component rust-src
run: rustup toolchain install nightly-2024-08-02 --profile minimal --target wasm32-unknown-unknown --component rust-src
9SMTM6 marked this conversation as resolved.
Show resolved Hide resolved
- name: Install npm deps
working-directory: ./test
run: npm ci
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Setup stable Rust
run: rustup target add wasm32-unknown-unknown
- name: Setup nightly Rust
run: rustup toolchain install nightly-2022-12-12 --profile minimal --target wasm32-unknown-unknown --component rust-src
run: rustup toolchain install nightly-2024-08-02 --profile minimal --target wasm32-unknown-unknown --component rust-src
9SMTM6 marked this conversation as resolved.
Show resolved Hide resolved
- name: Build demo
working-directory: ./demo
run: |
Expand Down
125 changes: 79 additions & 46 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "wasm-bindgen-rayon"
version = "1.2.1"
authors = ["Ingvar Stepanyan <[email protected]>"]
edition = "2018"
edition = "2021"
license = "Apache-2.0"
description = "Adapter for using Rayon-based concurrency on the Web"
keywords = ["web", "thread", "parallel", "concurrency", "webassembly"]
Expand All @@ -12,14 +12,14 @@ exclude = [".github"]
repository = "https://github.com/RReverser/wasm-bindgen-rayon"

[workspace.dependencies]
wasm-bindgen = "0.2.84"
wasm-bindgen = "0.2.93"
rayon = { version = "1.8.1", features = ["web_spin_lock"] }

[dependencies]
wasm-bindgen = { workspace = true }
rayon = { workspace = true }
crossbeam-channel = "0.5.9"
js-sys = "0.3.48"
js-sys = "0.3.70"

[workspace]
members = ["demo", "test"]
Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,21 @@ The other issue is that the Rust standard library for the WebAssembly target is

Since we want standard library to be thread-safe and [`std::sync`](https://doc.rust-lang.org/std/sync/) APIs to work, you'll need to use the nightly compiler toolchain and pass some flags to rebuild the standard library in addition to your own code.

In order to reduce risk of breakages, it's strongly recommended to use a fixed nightly version. For example, the latest stable Rust at the moment of writing is version 1.66, which corresponds to `nightly-2022-12-12`, which was tested and works with this crate.
In order to reduce risk of breakages, it's strongly recommended to use a fixed nightly version. For example, the latest stable Rust at the moment of writing is version 1.66, which corresponds to `nightly-2024-08-02`, which was tested and works with this crate.

### Using config files

The easiest way to configure those flags is:

1. Put a string `nightly-2022-12-12` in a `rust-toolchain` file in your project directory. This tells Rustup to use nightly toolchain by default for your project.
1. Put the following in a `rust-toolchain.toml` file in your project directory:
```toml
[toolchain]
channel = "nightly-2024-08-02"
components = ["rust-src"]
targets = ["wasm32-unknown-unknown"]
```

This tells rustup to use a fixed nightly toolchain with the wasm-target for your project, and to install rust-src, which is required for `build-std`.
2. Put the following in a `.cargo/config.toml` file in your project directory:

```toml
Expand All @@ -140,7 +148,7 @@ In that case, the whole command looks like this:

```sh
RUSTFLAGS='-C target-feature=+atomics,+bulk-memory,+mutable-globals' \
rustup run nightly-2022-12-12 \
rustup run nightly-2024-08-02 \
wasm-pack build --target web [...] \
-- -Z build-std=panic_abort,std
```
Expand Down
2 changes: 1 addition & 1 deletion demo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "wasm-bindgen-rayon-demo"
version = "0.1.0"
authors = ["Ingvar Stepanyan <[email protected]>"]
edition = "2018"
edition = "2021"
publish = false

[lib]
Expand Down
Loading
Loading