Skip to content

Compile for wasm32-wasip1: limit the performance.now() Instant shim t… - #345

Open
aojea wants to merge 1 commit into
eclipse-biscuit:mainfrom
aojea:wasi-instant-cfg
Open

aojea wants to merge 1 commit into
eclipse-biscuit:mainfrom
aojea:wasi-instant-cfg

Conversation

@aojea

@aojea aojea commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

…o wasm32-unknown-unknown

time.rs selected the wasm_bindgen-based Instant for every wasm32 target. On WASI targets wasm_bindgen is not available and std::time::Instant works, so biscuit-auth (and therefore biscuit-capi) failed to build:

error[E0425]: cannot find function `performance_now` in this scope

Gate the shim on all(target_arch = "wasm32", target_os = "unknown") and use std::time::Instant everywhere else. Add a CI job running cargo check --target wasm32-wasip1 for both crates so the target cannot silently regress.

This lets biscuit-capi be built as a WASI module and hosted by runtimes such as wazero, wasmtime, or proxy-wasm, without cgo or a JavaScript environment.

Assisted by AI

…o wasm32-unknown-unknown

`time.rs` selected the `wasm_bindgen`-based `Instant` for every `wasm32`
target. On WASI targets `wasm_bindgen` is not available and
`std::time::Instant` works, so `biscuit-auth` (and therefore
`biscuit-capi`) failed to build:

    error[E0425]: cannot find function `performance_now` in this scope

Gate the shim on `all(target_arch = "wasm32", target_os = "unknown")`
and use `std::time::Instant` everywhere else. Add a CI job running
`cargo check --target wasm32-wasip1` for both crates so the target
cannot silently regress.

This lets `biscuit-capi` be built as a WASI module and hosted by
runtimes such as wazero, wasmtime, or proxy-wasm, without cgo or a
JavaScript environment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant