diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c1565b..37cf42b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -130,7 +130,7 @@ jobs: - name: Run tests with miscellaneous features run: ${{ env.CARGO }} test --verbose --features logging - # Setup and run tests on the wasm32-wasi target via wasmtime. + # Setup and run tests on the wasm32-wasip1 target via wasmtime. wasm: runs-on: ubuntu-latest env: @@ -143,16 +143,16 @@ jobs: uses: dtolnay/rust-toolchain@master with: toolchain: stable - - name: Add wasm32-wasi target - run: rustup target add wasm32-wasi + - name: Add wasm32-wasip1 target + run: rustup target add wasm32-wasip1 - name: Download and install Wasmtime run: | - echo "CARGO_BUILD_TARGET=wasm32-wasi" >> $GITHUB_ENV + echo "CARGO_BUILD_TARGET=wasm32-wasip1" >> $GITHUB_ENV echo "RUSTFLAGS=-Ctarget-feature=+simd128" >> $GITHUB_ENV curl -LO https://github.com/bytecodealliance/wasmtime/releases/download/v$WASMTIME_VERSION/wasmtime-v$WASMTIME_VERSION-x86_64-linux.tar.xz tar xvf wasmtime-v$WASMTIME_VERSION-x86_64-linux.tar.xz echo `pwd`/wasmtime-v$WASMTIME_VERSION-x86_64-linux >> $GITHUB_PATH - echo "CARGO_TARGET_WASM32_WASI_RUNNER=wasmtime run --wasm simd --" >> $GITHUB_ENV + echo "CARGO_TARGET_WASM32_WASIP1_RUNNER=wasmtime run --wasm simd --" >> $GITHUB_ENV - name: Basic build run: cargo build --verbose - name: Run tests @@ -162,7 +162,7 @@ jobs: - name: Run tests without any features enabled (core-only) run: cargo test --verbose --no-default-features - # Setup and run tests on the wasm32-wasi target via wasmtime, but without + # Setup and run tests on the wasm32-wasip1 target via wasmtime, but without # simd128 enabled. wasm-no-simd128: runs-on: ubuntu-latest @@ -176,16 +176,16 @@ jobs: uses: dtolnay/rust-toolchain@master with: toolchain: stable - - name: Add wasm32-wasi target - run: rustup target add wasm32-wasi + - name: Add wasm32-wasip1 target + run: rustup target add wasm32-wasip1 - name: Download and install Wasmtime run: | - echo "CARGO_BUILD_TARGET=wasm32-wasi" >> $GITHUB_ENV + echo "CARGO_BUILD_TARGET=wasm32-wasip1" >> $GITHUB_ENV echo "RUSTFLAGS=-Ctarget-feature=-simd128" >> $GITHUB_ENV curl -LO https://github.com/bytecodealliance/wasmtime/releases/download/v$WASMTIME_VERSION/wasmtime-v$WASMTIME_VERSION-x86_64-linux.tar.xz tar xvf wasmtime-v$WASMTIME_VERSION-x86_64-linux.tar.xz echo `pwd`/wasmtime-v$WASMTIME_VERSION-x86_64-linux >> $GITHUB_PATH - echo "CARGO_TARGET_WASM32_WASI_RUNNER=wasmtime run --" >> $GITHUB_ENV + echo "CARGO_TARGET_WASM32_WASIP1_RUNNER=wasmtime run --" >> $GITHUB_ENV - name: Basic build run: cargo build --verbose - name: Run tests @@ -270,8 +270,8 @@ jobs: uses: dtolnay/rust-toolchain@master with: toolchain: stable - - name: Add wasm32-wasi target - run: rustup target add wasm32-wasi + - name: Add wasm32-wasip1 target + run: rustup target add wasm32-wasip1 - name: Download and install Wasmtime run: | # Note that we don't have to set CARGO_BUILD_TARGET and other diff --git a/benchmarks/engines.toml b/benchmarks/engines.toml index 5b504cf..7a0c6eb 100644 --- a/benchmarks/engines.toml +++ b/benchmarks/engines.toml @@ -62,28 +62,28 @@ bin = "wasmtime" args = [ "run", "--wasm", "simd", "--", - "./target/wasm32-wasi/release/main.wasm", + "./target/wasm32-wasip1/release/main.wasm", "--version", ] [engine.run] bin = "wasmtime" args = [ "run", "--wasm", "simd", "--", - "./target/wasm32-wasi/release/main.wasm", + "./target/wasm32-wasip1/release/main.wasm", "memchr-oneshot", ] [[engine.build]] bin = "cargo" args = ["build", "--release"] envs = [ - { name = "CARGO_BUILD_TARGET", value = "wasm32-wasi" }, + { name = "CARGO_BUILD_TARGET", value = "wasm32-wasip1" }, { name = "RUSTFLAGS", value = "-Ctarget-feature=+simd128" }, ] [[engine.clean]] bin = "cargo" args = ["clean"] envs = [ - { name = "CARGO_BUILD_TARGET", value = "wasm32-wasi" }, + { name = "CARGO_BUILD_TARGET", value = "wasm32-wasip1" }, { name = "RUSTFLAGS", value = "-Ctarget-feature=+simd128" }, ] @@ -546,7 +546,7 @@ # Engines that specifically target wasm32. These reuse the actual code from # existing engines in `rust/memchr`, but change the build configuration to -# build for `wasm32-wasi` and use the `wasmtime` JIT to actually run it. We +# build for `wasm32-wasip1` and use the `wasmtime` JIT to actually run it. We # don't define every possible engine for wasm32, but just a subset for basic # sanity checks. If it would be beneficial to be more exhaustive, please file # an issue. @@ -558,28 +558,28 @@ bin = "wasmtime" args = [ "run", "--wasm", "simd", "--", - "./target/wasm32-wasi/release/main.wasm", + "./target/wasm32-wasip1/release/main.wasm", "--version", ] [engine.run] bin = "wasmtime" args = [ "run", "--wasm", "simd", "--", - "./target/wasm32-wasi/release/main.wasm", + "./target/wasm32-wasip1/release/main.wasm", "memchr-prebuilt", ] [[engine.build]] bin = "cargo" args = ["build", "--release"] envs = [ - { name = "CARGO_BUILD_TARGET", value = "wasm32-wasi" }, + { name = "CARGO_BUILD_TARGET", value = "wasm32-wasip1" }, { name = "RUSTFLAGS", value = "-Ctarget-feature=+simd128" }, ] [[engine.clean]] bin = "cargo" args = ["clean"] envs = [ - { name = "CARGO_BUILD_TARGET", value = "wasm32-wasi" }, + { name = "CARGO_BUILD_TARGET", value = "wasm32-wasip1" }, { name = "RUSTFLAGS", value = "-Ctarget-feature=+simd128" }, ] @@ -590,28 +590,28 @@ bin = "wasmtime" args = [ "run", "--wasm", "simd", "--", - "./target/wasm32-wasi/release/main.wasm", + "./target/wasm32-wasip1/release/main.wasm", "--version", ] [engine.run] bin = "wasmtime" args = [ "run", "--wasm", "simd", "--", - "./target/wasm32-wasi/release/main.wasm", + "./target/wasm32-wasip1/release/main.wasm", "memchr-onlycount", ] [[engine.build]] bin = "cargo" args = ["build", "--release"] envs = [ - { name = "CARGO_BUILD_TARGET", value = "wasm32-wasi" }, + { name = "CARGO_BUILD_TARGET", value = "wasm32-wasip1" }, { name = "RUSTFLAGS", value = "-Ctarget-feature=+simd128" }, ] [[engine.clean]] bin = "cargo" args = ["clean"] envs = [ - { name = "CARGO_BUILD_TARGET", value = "wasm32-wasi" }, + { name = "CARGO_BUILD_TARGET", value = "wasm32-wasip1" }, { name = "RUSTFLAGS", value = "-Ctarget-feature=+simd128" }, ] @@ -622,28 +622,28 @@ bin = "wasmtime" args = [ "run", "--wasm", "simd", "--", - "./target/wasm32-wasi/release/main.wasm", + "./target/wasm32-wasip1/release/main.wasm", "--version", ] [engine.run] bin = "wasmtime" args = [ "run", "--wasm", "simd", "--", - "./target/wasm32-wasi/release/main.wasm", + "./target/wasm32-wasip1/release/main.wasm", "memchr2", ] [[engine.build]] bin = "cargo" args = ["build", "--release"] envs = [ - { name = "CARGO_BUILD_TARGET", value = "wasm32-wasi" }, + { name = "CARGO_BUILD_TARGET", value = "wasm32p1-wasi" }, { name = "RUSTFLAGS", value = "-Ctarget-feature=+simd128" }, ] [[engine.clean]] bin = "cargo" args = ["clean"] envs = [ - { name = "CARGO_BUILD_TARGET", value = "wasm32-wasi" }, + { name = "CARGO_BUILD_TARGET", value = "wasm32p1-wasi" }, { name = "RUSTFLAGS", value = "-Ctarget-feature=+simd128" }, ] @@ -654,28 +654,28 @@ bin = "wasmtime" args = [ "run", "--wasm", "simd", "--", - "./target/wasm32-wasi/release/main.wasm", + "./target/wasm32-wasip1/release/main.wasm", "--version", ] [engine.run] bin = "wasmtime" args = [ "run", "--wasm", "simd", "--", - "./target/wasm32-wasi/release/main.wasm", + "./target/wasm32-wasip1/release/main.wasm", "memchr3", ] [[engine.build]] bin = "cargo" args = ["build", "--release"] envs = [ - { name = "CARGO_BUILD_TARGET", value = "wasm32-wasi" }, + { name = "CARGO_BUILD_TARGET", value = "wasm32-wasip1" }, { name = "RUSTFLAGS", value = "-Ctarget-feature=+simd128" }, ] [[engine.clean]] bin = "cargo" args = ["clean"] envs = [ - { name = "CARGO_BUILD_TARGET", value = "wasm32-wasi" }, + { name = "CARGO_BUILD_TARGET", value = "wasm32-wasip1" }, { name = "RUSTFLAGS", value = "-Ctarget-feature=+simd128" }, ] @@ -686,28 +686,28 @@ bin = "wasmtime" args = [ "run", "--wasm", "simd", "--", - "./target/wasm32-wasi/release/main.wasm", + "./target/wasm32-wasip1/release/main.wasm", "--version", ] [engine.run] bin = "wasmtime" args = [ "run", "--wasm", "simd", "--", - "./target/wasm32-wasi/release/main.wasm", + "./target/wasm32-wasip1/release/main.wasm", "memmem-prebuilt", ] [[engine.build]] bin = "cargo" args = ["build", "--release"] envs = [ - { name = "CARGO_BUILD_TARGET", value = "wasm32-wasi" }, + { name = "CARGO_BUILD_TARGET", value = "wasm32-wasip1" }, { name = "RUSTFLAGS", value = "-Ctarget-feature=+simd128" }, ] [[engine.clean]] bin = "cargo" args = ["clean"] envs = [ - { name = "CARGO_BUILD_TARGET", value = "wasm32-wasi" }, + { name = "CARGO_BUILD_TARGET", value = "wasm32-wasip1" }, { name = "RUSTFLAGS", value = "-Ctarget-feature=+simd128" }, ] diff --git a/src/arch/all/packedpair/mod.rs b/src/arch/all/packedpair/mod.rs index 148a985..3b40d1e 100644 --- a/src/arch/all/packedpair/mod.rs +++ b/src/arch/all/packedpair/mod.rs @@ -176,7 +176,7 @@ impl Pair { core::mem::swap(&mut rare1, &mut rare2); core::mem::swap(&mut index1, &mut index2); } - let max = usize::from(core::u8::MAX); + let max = usize::from(u8::MAX); for (i, &b) in needle.iter().enumerate().take(max).skip(2) { if ranker.rank(b) < ranker.rank(rare1) { rare2 = rare1; diff --git a/src/memmem/searcher.rs b/src/memmem/searcher.rs index 2a533e0..8d99a4e 100644 --- a/src/memmem/searcher.rs +++ b/src/memmem/searcher.rs @@ -915,7 +915,7 @@ impl PrefilterState { // `skipped` to overflow a `u32`. (And we use a `u32` to reduce the // size of a prefilter state.) self.skipped = match u32::try_from(skipped) { - Err(_) => core::u32::MAX, + Err(_) => u32::MAX, Ok(skipped) => self.skipped.saturating_add(skipped), }; }