diff --git a/.evergreen/MSRV-Cargo.toml.diff b/.evergreen/MSRV-Cargo.toml.diff index 437441ae..e69de29b 100644 --- a/.evergreen/MSRV-Cargo.toml.diff +++ b/.evergreen/MSRV-Cargo.toml.diff @@ -1,10 +0,0 @@ ---- Cargo.toml 2024-12-12 10:00:04 -+++ Cargo.toml.msrv 2024-12-12 10:20:57 -@@ -57,6 +57,7 @@ - - [dependencies] - ahash = "0.8.0" -+bumpalo = "=3.14.0" - chrono = { version = "0.4.15", features = ["std"], default-features = false, optional = true } - rand = "0.8" - serde = { version = "1.0", features = ["derive"] } diff --git a/.evergreen/compile-only.sh b/.evergreen/compile-only.sh index 395267e7..dc56e238 100755 --- a/.evergreen/compile-only.sh +++ b/.evergreen/compile-only.sh @@ -10,6 +10,9 @@ if [ ! -z "$TARGET" ]; then # renamed in newer versions of rustc TARGET="wasm32-wasip1" fi + if [[ "$TARGET" = "wasm32-unknown-unknown" ]]; then + export RUSTFLAGS='--cfg getrandom_backend="wasm_js"' + fi rustup target add $TARGET --toolchain $RUST_VERSION TARGET="--target=$TARGET" fi diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 673b5ffc..ae773d9f 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -216,9 +216,9 @@ axes: - id: "extra-rust-versions" values: - id: "min" - display_name: "1.71.1 (minimum supported version)" + display_name: "1.81 (minimum supported version)" variables: - RUST_VERSION: "1.71.1" + RUST_VERSION: "1.81" MSRV: "true" - id: "nightly" display_name: "nightly" @@ -242,7 +242,7 @@ buildvariants: name: "tests" display_name: "Tests" run_on: - - ubuntu1804-test + - ubuntu2204-small tasks: - name: "test" @@ -252,7 +252,7 @@ buildvariants: extra-targets: "*" display_name: "Compile on Rust ${extra-rust-versions} (${extra-targets})" run_on: - - ubuntu1804-test + - ubuntu2204-small tasks: - name: "compile-only" @@ -260,7 +260,7 @@ buildvariants: name: "lint" display_name: "Lint" run_on: - - ubuntu1804-test + - ubuntu2204-small tasks: - name: "check-clippy" - name: "check-rustfmt" @@ -270,7 +270,7 @@ buildvariants: name: "fuzz" display_name: "Raw BSON Fuzzer" run_on: - - ubuntu1804-test + - ubuntu2204-small tasks: - name: "run-fuzzer" @@ -278,6 +278,6 @@ buildvariants: name: "wasm" display_name: "WASM" run_on: - - ubuntu1804-test + - ubuntu2204-small tasks: - name: "wasm-test" diff --git a/.evergreen/run-wasm-tests.sh b/.evergreen/run-wasm-tests.sh index 18c835ca..4f7d8666 100755 --- a/.evergreen/run-wasm-tests.sh +++ b/.evergreen/run-wasm-tests.sh @@ -4,10 +4,14 @@ set -o errexit . ~/.cargo/env -rustup update 1.81 -rustup default 1.81 - curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh +# install nvm +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash +. ~/.nvm/nvm.sh +# install node +nvm install --no-progress node +node --version + cd $(dirname $0)/../wasm-test wasm-pack test --node \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 683c2299..16cd6c60 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -73,8 +73,12 @@ serde_with-3 = { package = "serde_with", version = "3.1.0", optional = true } time = { version = "0.3.9", features = ["formatting", "parsing", "macros", "large-dates"] } bitvec = "1.0.1" serde_path_to_error = { version = "0.1.16", optional = true } + [target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies] js-sys = "0.3" +uuid = { version = "1.1.2", features = ["serde", "v4", "js"] } +getrandom = { version = "0.2", features = ["js"] } +getrandom_03 = { package = "getrandom", version = "0.3", features = ["wasm_js"] } [dev-dependencies] assert_matches = "1.2" @@ -84,8 +88,6 @@ proptest = "1.0.0" serde_bytes = "0.11" serde_path_to_error = "0.1.16" chrono = { version = "0.4", features = ["serde", "clock", "std"], default-features = false } -[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dev-dependencies] -getrandom = { version = "0.2", features = ["js"] } [package.metadata.docs.rs] all-features = true diff --git a/README.md b/README.md index efb48dc4..d9ba4093 100644 --- a/README.md +++ b/README.md @@ -269,7 +269,7 @@ This crate compiles to the `wasm32-unknown-unknown` target; when doing so, the ` ## Minimum supported Rust version (MSRV) -The MSRV for this crate is currently 1.71.1. Increases to the MSRV will only happen in a minor or major version release, and will be to a Rust version at least six months old. +The MSRV for this crate is currently 1.81. Increases to the MSRV will only happen in a minor or major version release, and will be to a Rust version at least six months old. ## Contributing diff --git a/clippy.toml b/clippy.toml index 49c31fa5..40d6ec53 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1 +1 @@ -msrv = "1.71.1" \ No newline at end of file +msrv = "1.81" \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 077a2db6..11fc5373 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -277,7 +277,7 @@ //! //! ## Minimum supported Rust version (MSRV) //! -//! The MSRV for this crate is currently 1.71.1. This will be rarely be increased, and if it ever +//! The MSRV for this crate is currently 1.81. This will be rarely be increased, and if it ever //! is, it will only happen in a minor or major version release. #![allow(clippy::cognitive_complexity, clippy::derive_partial_eq_without_eq)] diff --git a/wasm-test/.cargo/config.toml b/wasm-test/.cargo/config.toml new file mode 100644 index 00000000..fa995ebe --- /dev/null +++ b/wasm-test/.cargo/config.toml @@ -0,0 +1,2 @@ +[build] +rustflags = ["--cfg", "getrandom_backend=\"wasm_js\""] \ No newline at end of file diff --git a/wasm-test/Cargo.toml b/wasm-test/Cargo.toml index fb583123..92c37de6 100644 --- a/wasm-test/Cargo.toml +++ b/wasm-test/Cargo.toml @@ -11,7 +11,6 @@ crate-type = ["cdylib", "rlib"] [dependencies] bson = { path = ".." } -getrandom = { version = "0.2", features = ["js"] } [dev-dependencies] wasm-bindgen-test = "0.3.0" \ No newline at end of file