1 use test_programs::p3::wasi as wasip3; 2 3 #[link(wasm_import_module = "wasi:clocks/monotonic-clock@0.3.0-rc-2026-03-15")] 4 unsafe extern "C" { 5 #[link_name = "[async-lower]wait-for"] wait_for(dur: u64) -> u326 fn wait_for(dur: u64) -> u32; 7 } 8 9 struct Component; 10 11 test_programs::p3::export!(Component); 12 13 impl test_programs::p3::exports::wasi::cli::run::Guest for Component { run() -> Result<(), ()>14 async fn run() -> Result<(), ()> { 15 // Execute it once to ensure we get type information pulled in. 16 wasip3::clocks::monotonic_clock::wait_for(0).await; 17 18 // Execute the raw function without Rust bindings to stress invoking it 19 // many times. 20 for _ in 0..1000 { 21 unsafe { 22 wait_for(1 << 60); 23 } 24 } 25 26 panic!("should have trapped before now"); 27 } 28 } 29 main()30fn main() { 31 unreachable!(); 32 } 33