Skip to content

Commit

Permalink
Update nightly versions in CI and examples, update rust-editions, upd…
Browse files Browse the repository at this point in the history
…ate js dependencies, switch to rust-toolchain.toml
  • Loading branch information
9SMTM6 committed Sep 13, 2024
1 parent c7127de commit 4a673ff
Show file tree
Hide file tree
Showing 12 changed files with 3,637 additions and 8,598 deletions.
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
- 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
- name: Build demo
working-directory: ./demo
run: |
Expand Down
2 changes: 1 addition & 1 deletion 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 <me@rreverser.com>"]
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 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 <me@rreverser.com>"]
edition = "2018"
edition = "2021"
publish = false

[lib]
Expand Down
Loading

0 comments on commit 4a673ff

Please sign in to comment.