diff --git a/crates/wasi-http/src/lib.rs b/crates/wasi-http/src/lib.rs index fc0d98b4aee3..2d9879f5401c 100644 --- a/crates/wasi-http/src/lib.rs +++ b/crates/wasi-http/src/lib.rs @@ -78,6 +78,7 @@ pub mod bindings { trappable_error_type: { "wasi:http/types/error-code" => crate::HttpError, }, + features: ["clocks-timezone"], }); pub use wasi::http; diff --git a/crates/wasi-http/src/proxy.rs b/crates/wasi-http/src/proxy.rs index 2fdf3adb6c8c..2c75f2c6c8f5 100644 --- a/crates/wasi-http/src/proxy.rs +++ b/crates/wasi-http/src/proxy.rs @@ -15,6 +15,7 @@ mod bindings { "wasi:http": crate::bindings::http, "wasi": wasmtime_wasi::bindings, }, + features: ["clocks-timezone"], }); } @@ -140,6 +141,7 @@ pub mod sync { "wasi": wasmtime_wasi::bindings, // everything else }, require_store_data_send: true, + features: ["clocks-timezone"], }); } diff --git a/crates/wasi-preview1-component-adapter/src/lib.rs b/crates/wasi-preview1-component-adapter/src/lib.rs index 142d1a3dffff..ab1e795dbe5e 100644 --- a/crates/wasi-preview1-component-adapter/src/lib.rs +++ b/crates/wasi-preview1-component-adapter/src/lib.rs @@ -62,6 +62,7 @@ pub mod bindings { // Instead, we manually define the bindings for these functions in // terms of raw pointers. skip: ["run", "get-environment", "poll"], + features: ["clocks-timezone"], }); #[cfg(feature = "reactor")] @@ -78,6 +79,7 @@ pub mod bindings { // Instead, we manually define the bindings for these functions in // terms of raw pointers. skip: ["get-environment", "poll"], + features: ["clocks-timezone"], }); #[cfg(feature = "proxy")] @@ -99,6 +101,7 @@ pub mod bindings { raw_strings, runtime_path: "crate::bindings::wit_bindgen_rt_shim", skip: ["poll"], + features: ["clocks-timezone"], }); pub mod wit_bindgen_rt_shim { diff --git a/crates/wasi/src/bindings.rs b/crates/wasi/src/bindings.rs index 751dc9dcfe71..7bd3f06ac6cf 100644 --- a/crates/wasi/src/bindings.rs +++ b/crates/wasi/src/bindings.rs @@ -1,5 +1,3 @@ -// Generate traits for synchronous bindings. -// // Note that this is only done for interfaces which can block, or those which // have some functions in `only_imports` below for being async. pub mod sync { @@ -40,6 +38,7 @@ pub mod sync { "wasi:sockets/udp/udp-socket": super::super::sockets::udp::UdpSocket, }, require_store_data_send: true, + features: ["clocks-timezone"], }); } pub use self::generated::exports; @@ -209,6 +208,7 @@ mod async_io { "wasi:cli/terminal-input/terminal-input": crate::stdio::TerminalInput, "wasi:cli/terminal-output/terminal-output": crate::stdio::TerminalOutput, }, + features: ["clocks-timezone"], }); } diff --git a/crates/wasi/src/host/clocks.rs b/crates/wasi/src/host/clocks.rs index 3c0945f7ebb3..0755d0c5c35e 100644 --- a/crates/wasi/src/host/clocks.rs +++ b/crates/wasi/src/host/clocks.rs @@ -109,7 +109,10 @@ impl Subscribe for Deadline { } } -impl timezone::Host for T { +impl timezone::Host for WasiImpl +where + T: WasiView, +{ fn display(&mut self, when: Datetime) -> anyhow::Result { let duration = std::time::Duration::new(when.seconds, when.nanoseconds); Ok(self.ctx().timezone.display(duration)) diff --git a/crates/wasi/wit/deps/cli/imports.wit b/crates/wasi/wit/deps/cli/imports.wit index 083b84a036d7..901c04842bfe 100644 --- a/crates/wasi/wit/deps/cli/imports.wit +++ b/crates/wasi/wit/deps/cli/imports.wit @@ -1,6 +1,7 @@ package wasi:cli@0.2.0; world imports { + @unstable(feature = clocks-timezone) include wasi:clocks/imports@0.2.0; include wasi:filesystem/imports@0.2.0; include wasi:sockets/imports@0.2.0;