Uploaded image for project: 'Rust Driver'
  1. Rust Driver
  2. RUST-1808

bson-rust - PR #445: Fix compilation on `wasm32-wasi` target

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • bson-2.8.1
    • Affects Version/s: None
    • Component/s: None

      tyranron has created PR #445: Fix compilation on `wasm32-wasi` target in bson-rust

      Issue Text:

        1. 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`.

        1. Solution
      • [x] Fix importing according to the new `cfg` rules for WASM targets.
      • [x] Check compilation under WASM targets on CI.

            Assignee:
            abraham.egnor@mongodb.com Abraham Egnor
            Reporter:
            dbeng-pm-bot PM Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: