Skip to content

Commit e5ba80a

Browse files
committed
use const
1 parent 7658a13 commit e5ba80a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/libstd/sys/wasi/thread.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ impl Thread {
3030
let nanos = dur.as_nanos();
3131
assert!(nanos <= u64::max_value() as u128);
3232

33+
const CLOCK_ID: wasi::Userdata = 0x0123_45678;
34+
3335
let clock = wasi::raw::__wasi_subscription_u_clock_t {
34-
identifier: 0x0123_45678,
36+
identifier: CLOCK_ID,
3537
clock_id: wasi::CLOCK_MONOTONIC,
3638
timeout: nanos as u64,
3739
precision: 0,
@@ -47,7 +49,7 @@ impl Thread {
4749
let n = wasi::poll_oneoff(&in_, &mut out).unwrap();
4850
let wasi::Event { userdata, error, type_, .. } = out[0];
4951
match (n, userdata, error) {
50-
(1, 0x0123_45678, 0) if type_ == wasi::EVENTTYPE_CLOCK => {}
52+
(1, CLOCK_ID, 0) if type_ == wasi::EVENTTYPE_CLOCK => {}
5153
_ => panic!("thread::sleep(): unexpected result of poll_oneoff"),
5254
}
5355
}

0 commit comments

Comments
 (0)