mongodb / bson-rust

Encoding and decoding support for BSON in Rust
MIT License
389 stars 130 forks source link

RUST-1805 Only use js-sys with unknown os #442

Closed abr-egn closed 7 months ago

abr-egn commented 7 months ago

Fixes #441.

tyranron commented 7 months ago

This broke the 2.8.0 release on wasm32-wasi targets:

 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.