miri: Can't call foreign function: clock_gettime

cargo +nightly miri -V # miri 0.1.0 (76138c5 2019-02-17)
rustc -vV # 1.34.0-nightly (146aa60f3 2019-02-18)

How to reproduce:

cd tokio
git log -n1 # commit 4985e0c6084646e0de2a42b361ca897882eff504
$ cargo +nightly miri test
   Compiling tokio v0.1.15 (/home/humbug/tokio)
running 1 test
error[E0080]: constant evaluation error: can't call foreign function: clock_gettime
   --> /home/humbug/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/sys/unix/time.rs:361:13
    |
361 |             libc::clock_gettime(clock, &mut t.t)
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't call foreign function: clock_gettime
    |
    = note: inside call to `std::sys::unix::time::inner::now` at /home/humbug/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/sys/unix/time.rs:275:26
    = note: inside call to `std::sys::unix::time::inner::Instant::now` at /home/humbug/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/time.rs:158:22
    = note: inside call to `std::time::Instant::now` at /home/humbug/tokio/tokio-timer/src/clock/clock.rs:48:17
    = note: inside call to closure at /home/humbug/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/thread/local.rs:300:16
    = note: inside call to `<std::thread::LocalKey<T>><std::cell::Cell<std::option::Option<*const tokio_timer::clock::Clock>>>::try_with::<[closure@DefId(54/1:9 ~ tokio_timer[4753]::clock[0]::clock[0]::now[0]::{{closure}}[0])], std::time::Instant>` at /home/humbug/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/thread/local.rs:246:9
    = note: inside call to `<std::thread::LocalKey<T>><std::cell::Cell<std::option::Option<*const tokio_timer::clock::Clock>>>::with::<[closure@DefId(54/1:9 ~ tokio_timer[4753]::clock[0]::clock[0]::now[0]::{{closure}}[0])], std::time::Instant>` at /home/humbug/tokio/tokio-timer/src/clock/clock.rs:46:5
    = note: inside call to `tokio_timer::clock::now` at /home/humbug/tokio/tokio-timer/src/timeout.rs:128:40
note: inside call to `<tokio_timer::Timeout<T>><futures::Finished<(), ()>>::new` at src/util/future.rs:64:9
   --> src/util/future.rs:64:9
    |
64  |         Timeout::new(self, timeout)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside call to `<futures::Finished<(), ()> as util::future::FutureExt>::timeout` at src/util/future.rs:90:32
   --> src/util/future.rs:90:32
    |
90  |         let timeouted_future = base_future.timeout(Duration::new(0, 0));
    |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside call to `util::future::test::timeout_polls_at_least_once` at src/util/future.rs:88:5
   --> src/util/future.rs:88:5
    |
88  | /     fn timeout_polls_at_least_once() {
89  | |         let base_future = future::result::<(), ()>(Ok(()));
90  | |         let timeouted_future = base_future.timeout(Duration::new(0, 0));
91  | |         assert!(timeouted_future.wait().is_ok());
92  | |     }
    | |_____^

...
...
...

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 25 (22 by maintainers)

Commits related to this issue

Most upvoted comments

Eh, the clock isn’t implemented yet. So enabling communication won’t make a difference for that.

Miri evaluation error: can’t call foreign function: stat64

Looks like you are doing file system access. That’s a lot of shims that someone has to implement. See https://github.com/rust-lang/miri/issues/923.