Closed
Description
Hi.
Thank you guys for your great project.
I am trying wasm32-unknown-unknown and got an error(panic) in std::time::SystemTime::now().
Here is a reproduction code.
#[no_mangle]
pub fn test() -> u32 {
use std::time;
let now = time::SystemTime::now();
return 1;
}
<html lang="en">
<head>
<meta charset="utf-8">
<script>
fetch('wasm_time.wasm')
.then((response) => response.arrayBuffer())
.then((bytes) => WebAssembly.instantiate(bytes, {}))
.then((results) => {
const instance = results.instance;
console.log(instance.exports.test());
});
</script>
</head>
<body>
</body>
</html>
The error on Chrome on macOS. Similar error on Safari on macOS.
wasm-000873fa-78:2 Uncaught (in promise) RuntimeError: unreachable
at __rust_start_panic (wasm-function[78]:1)
at rust_panic (wasm-function[19]:40)
at _ZN3std9panicking20rust_panic_with_hook17h4d23d2414abbb417E (wasm-function[14]:708)
at _ZN3std9panicking11begin_panic17ha318dfc1360611dcE (wasm-function[11]:298)
at _ZN3std3sys4wasm11TimeSysCall7perform17hfcfe4d7cbd5bdf2dE (wasm-function[69]:31)
at _ZN3std3sys4wasm4time10SystemTime3now17h259757a3c249e0c6E (wasm-function[71]:20)
at _ZN3std4time10SystemTime3now17hd79e83558f3b295bE (wasm-function[70]:1)
at test (wasm-function[0]:38)
at fetch.then.then.then (http://localhost:8000/:10:40)
at <anonymous>
__rust_start_panic @ wasm-000873fa-78:2
rust_panic @ wasm-000873fa-19:21
_ZN3std9panicking20rust_panic_with_hook17h4d23d2414abbb417E @ wasm-000873fa-14:346
_ZN3std9panicking11begin_panic17ha318dfc1360611dcE @ wasm-000873fa-11:146
_ZN3std3sys4wasm11TimeSysCall7perform17hfcfe4d7cbd5bdf2dE @ wasm-000873fa-69:16
_ZN3std3sys4wasm4time10SystemTime3now17h259757a3c249e0c6E @ wasm-000873fa-71:12
_ZN3std4time10SystemTime3now17hd79e83558f3b295bE @ wasm-000873fa-70:2
test @ wasm-000873fa-0:20
fetch.then.then.then @ (index):10
Promise.then (async)
(anonymous) @ (index):8
My environment is,
OS : macOS 10.13.3
Rust: rustc 1.26.0-nightly (322d7f7 2018-02-25)
Chrome: 64.0.3282.167
Sorry, I have no idea to confirm the version of wasm32-unknown-unknown.
Cheers.