-
Type: Task
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
tyranron has created PR #445: Fix compilation on `wasm32-wasi` target in bson-rust
Issue Text:
-
- Synopsis
See https://github.com/mongodb/bson-rust/pull/442#issuecomment-1851849879:
> This [broke the 2.8.0 release on `wasm32-wasi` targets](https://github.com/graphql-rust/juniper/actions/runs/7173028592/job/19531503717#step:4:171):
>
> ```
> error[E0433]: failed to resolve: use of undeclared type `SystemTime`
> --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bson-2.8.0/src/oid.rs:245:30
> |
> 245 | let timestamp: u32 = SystemTime::now()
> | ^^^^^^^^^^ use of undeclared type `SystemTime`
> |
> help: consider importing this struct
> |
> 4 + use std::time::SystemTime;
> |
>
> error[E0433]: failed to resolve: use of undeclared type `SystemTime`
> --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bson-2.8.0/src/oid.rs:246:29
> |
> 246 | .duration_since(SystemTime::UNIX_EPOCH)
> | ^^^^^^^^^^ use of undeclared type `SystemTime`
> |
> help: consider importing this struct
> |
> 4 + use std::time::SystemTime;
> ```
>
> To reproduce, just run `cargo check -p bson --target wasm32-wasi`.
-
- Solution
- [x] Fix importing according to the new `cfg` rules for WASM targets.
- [x] Check compilation under WASM targets on CI.