Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miri hangs when a test fails #1780

Closed
NathanSWard opened this issue Apr 19, 2021 · 7 comments
Closed

Miri hangs when a test fails #1780

NathanSWard opened this issue Apr 19, 2021 · 7 comments
Labels
A-aliasing Area: This affects the aliasing model (Stacked/Tree Borrows) I-slow Impact: Makes Miri even slower than it already is

Comments

@NathanSWard
Copy link

NathanSWard commented Apr 19, 2021

Given the simple library:

#[cfg(test)]
mod tests {

    #[test]
    fn failed() {
        assert_eq!(1, 2);
    }
}

and then running

RUST_BACKTRACE=full MIRIFLAGS="-Zmiri-disable-isolation" cargo +nightly miri test

the output results in:

    Finished test [unoptimized + debuginfo] target(s) in 0.00s
     Running unittests (target/x86_64-unknown-linux-gnu/debug/deps/test_miri-72fa64ca114eaddd)

running 1 test
test tests::failed ... FAILED

failures:

and then just infinitely hangs.

@RalfJung
Copy link
Member

Lol, I don't think I ever ran Miri on a test suite that failed in a well-defined way, i.e., without causing Miri to stop during UB.^^

-Zmiri-disable-isolation is known to make libtest very slow (#1702); what happens when you remove that flag?

@RalfJung
Copy link
Member

This might be related to backtrace printing; Cc @Aaron1011

@Aaron1011
Copy link
Member

This hangs for me with RUST_BACKTRACE=0 MIRIFLAGS="-Zmiri-disable-isolation" cargo +nightly miri test, so I think it's caused by -Zmiri-disable-isolation

@ghost
Copy link

ghost commented Apr 20, 2021

@Aaron1011 Are you sure? This did not hang for me with exactly RUST_BACKTRACE=0 MIRIFLAGS="-Zmiri-disable-isolation" (with Miri 36176cd). It did hang with RUST_BACKTRACE=1 MIRIFLAGS="-Zmiri-disable-isolation" cargo miri test instead.

@ghost
Copy link

ghost commented May 1, 2021

This is not related to -Zmiri-disable-isolation but related to Stacked Borrows:

$ cat hang.rs
#[test]
fn foo() {
    std::env::set_var("RUST_BACKTRACE", "1");
    panic!();
}
$ time miri --sysroot ~/.cache/miri/HOST --test hang.rs -Zmiri-disable-stacked-borrows

running 1 test
test foo ... FAILED

failures:

---- foo stdout ----
thread 'main' panicked at 'explicit panic', hang.rs:4:5
stack backtrace:
   0: std::rt::begin_panic::<&str>
             at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:519:12
   1: foo
             at hang.rs:4:5
   2: foo::{closure#0}
             at hang.rs:2:1
   3: <[[email protected]:2:1: 5:2] as std::ops::FnOnce<()>>::call_once - shim
             at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
   4: <fn() as std::ops::FnOnce<()>>::call_once - shim(fn())
             at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
   5: test::run_test::{closure#2}
             at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:568:30
   6: <[closure@test::run_test::{closure#2}] as std::ops::FnOnce<()>>::call_once - shim(vtable)
             at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
   7: <std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send> as std::ops::FnOnce<()>>::call_once
             at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1546:9
   8: <std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>> as std::ops::FnOnce<()>>::call_once
             at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panic.rs:344:9
   9: std::panicking::try::do_call::<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>, ()>
             at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:379:40
  10: std::panicking::try::<(), std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>>
             at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:343:19
  11: std::panic::catch_unwind::<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>, ()>
             at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panic.rs:431:14
  12: test::run_test_in_process
             at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:600:18
  13: test::run_test::run_test_inner::{closure#0}
             at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:492:39
  14: test::run_test::run_test_inner
             at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:530:13
  15: test::run_test
             at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:564:28
  16: test::run_tests::<[closure@test::run_tests_console::{closure#2}]>
             at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:305:17
  17: test::run_tests_console
             at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/console.rs:289:5
  18: test::test_main
             at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:122:15
  19: test::test_main_static
             at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:141:5
  20: main
             at hang.rs:1:1
  21: <fn() as std::ops::FnOnce<()>>::call_once - shim(fn())
             at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
  22: std::rt::lang_start::<()>::{closure#0}
             at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/rt.rs:49:18
  23: std::ops::function::impls::<impl std::ops::FnOnce<()> for &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>::call_once
             at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:259:13
  24: std::panicking::try::do_call::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>
             at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:379:40
  25: std::panicking::try::<i32, &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>
             at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:343:19
  26: std::panic::catch_unwind::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>
             at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panic.rs:431:14
  27: std::rt::lang_start_internal
             at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/rt.rs:34:21
  28: std::rt::lang_start::<()>
             at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/rt.rs:48:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.


failures:
    foo

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out


real	0m5.681s
user	0m5.627s
sys	0m0.052s
$ time miri --sysroot ~/.cache/miri/HOST --test hang.rs

running 1 test
test foo ... FAILED

failures:
^C

real	2m2.036s
user	2m1.527s
sys	0m0.488s

@ghost
Copy link

ghost commented May 1, 2021

This is probably not related to backtrace printing because this also makes Miri hang (without -Zmiri-disable-stacked-borrows and does not make it hang with -Zmiri-disable-stacked-borrows):

const BACKTRACE_TEXT: &str = "fake stack backtrace:
0: std::rt::begin_panic::<&str>
          at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:519:12
1: foo
          at hang.rs:4:5
2: foo::{closure#0}
          at hang.rs:2:1
3: <[[email protected]:2:1: 5:2] as std::ops::FnOnce<()>>::call_once - shim
          at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
4: <fn() as std::ops::FnOnce<()>>::call_once - shim(fn())
          at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
5: test::run_test::{closure#2}
          at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:568:30
6: <[closure@test::run_test::{closure#2}] as std::ops::FnOnce<()>>::call_once - shim(vtable)
          at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
7: <std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send> as std::ops::FnOnce<()>>::call_once
          at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1546:9
8: <std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>> as std::ops::FnOnce<()>>::call_once
          at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panic.rs:344:9
9: std::panicking::try::do_call::<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>, ()>
          at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:379:40
10: std::panicking::try::<(), std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>>
          at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:343:19
11: std::panic::catch_unwind::<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>, ()>
          at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panic.rs:431:14
12: test::run_test_in_process
          at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:600:18
13: test::run_test::run_test_inner::{closure#0}
          at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:492:39
14: test::run_test::run_test_inner
          at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:530:13
15: test::run_test
          at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:564:28
16: test::run_tests::<[closure@test::run_tests_console::{closure#2}]>
          at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:305:17
17: test::run_tests_console
          at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/console.rs:289:5
18: test::test_main
          at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:122:15
19: test::test_main_static
          at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:141:5
20: main
          at hang.rs:1:1
21: <fn() as std::ops::FnOnce<()>>::call_once - shim(fn())
          at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
22: std::rt::lang_start::<()>::{closure#0}
          at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/rt.rs:49:18
23: std::ops::function::impls::<impl std::ops::FnOnce<()> for &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>::call_once
          at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:259:13
24: std::panicking::try::do_call::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>
          at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:379:40
25: std::panicking::try::<i32, &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>
          at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:343:19
26: std::panic::catch_unwind::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>
          at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panic.rs:431:14
27: std::rt::lang_start_internal
          at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/rt.rs:34:21
28: std::rt::lang_start::<()>
          at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/rt.rs:48:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.";

#[test]
fn foo() {
    eprintln!("{}", BACKTRACE_TEXT);
    panic!();
}

So it's probably related to output capturing (maybe here?) in libtest, and indeed adding --nocapture can fix the hang.

String::from_utf8_lossy() can indeed make Miri hang, while std::str::from_utf8() can even finish in the playground:

fn main() {
    String::from_utf8_lossy("stack backtrace:
0: std::rt::begin_panic::<&str>
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:519:12
1: foo
            at hang.rs:4:5
2: foo::{closure#0}
            at hang.rs:2:1
3: <[[email protected]:2:1: 5:2] as std::ops::FnOnce<()>>::call_once - shim
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
4: <fn() as std::ops::FnOnce<()>>::call_once - shim(fn())
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
5: test::run_test::{closure#2}
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:568:30
6: <[closure@test::run_test::{closure#2}] as std::ops::FnOnce<()>>::call_once - shim(vtable)
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
7: <std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send> as std::ops::FnOnce<()>>::call_once
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1546:9
8: <std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>> as std::ops::FnOnce<()>>::call_once
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panic.rs:344:9
9: std::panicking::try::do_call::<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>, ()>
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:379:40
10: std::panicking::try::<(), std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>>
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:343:19
11: std::panic::catch_unwind::<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>, ()>
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panic.rs:431:14
12: test::run_test_in_process
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:600:18
13: test::run_test::run_test_inner::{closure#0}
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:492:39
14: test::run_test::run_test_inner
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:530:13
15: test::run_test
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:564:28
16: test::run_tests::<[closure@test::run_tests_console::{closure#2}]>
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:305:17
17: test::run_tests_console
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/console.rs:289:5
18: test::test_main
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:122:15
19: test::test_main_static
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:141:5
20: main
            at hang.rs:1:1
21: <fn() as std::ops::FnOnce<()>>::call_once - shim(fn())
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
22: std::rt::lang_start::<()>::{closure#0}
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/rt.rs:49:18
23: std::ops::function::impls::<impl std::ops::FnOnce<()> for &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>::call_once
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:259:13
24: std::panicking::try::do_call::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:379:40
25: std::panicking::try::<i32, &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:343:19
26: std::panic::catch_unwind::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panic.rs:431:14
27: std::rt::lang_start_internal
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/rt.rs:34:21
28: std::rt::lang_start::<()>
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/rt.rs:48:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.".as_bytes());
}
Minified from String::from_utf8_lossy()
fn main() {
    let source = b"stack backtrace:
0: std::rt::begin_panic::<&str>
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:519:12
1: foo
            at hang.rs:4:5
2: foo::{closure#0}
            at hang.rs:2:1
3: <[[email protected]:2:1: 5:2] as std::ops::FnOnce<()>>::call_once - shim
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
4: <fn() as std::ops::FnOnce<()>>::call_once - shim(fn())
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
5: test::run_test::{closure#2}
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:568:30
6: <[closure@test::run_test::{closure#2}] as std::ops::FnOnce<()>>::call_once - shim(vtable)
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
7: <std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send> as std::ops::FnOnce<()>>::call_once
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1546:9
8: <std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>> as std::ops::FnOnce<()>>::call_once
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panic.rs:344:9
9: std::panicking::try::do_call::<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>, ()>
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:379:40
10: std::panicking::try::<(), std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>>
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:343:19
11: std::panic::catch_unwind::<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>, ()>
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panic.rs:431:14
12: test::run_test_in_process
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:600:18
13: test::run_test::run_test_inner::{closure#0}
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:492:39
14: test::run_test::run_test_inner
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:530:13
15: test::run_test
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:564:28
16: test::run_tests::<[closure@test::run_tests_console::{closure#2}]>
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:305:17
17: test::run_tests_console
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/console.rs:289:5
18: test::test_main
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:122:15
19: test::test_main_static
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/test/src/lib.rs:141:5
20: main
            at hang.rs:1:1
21: <fn() as std::ops::FnOnce<()>>::call_once - shim(fn())
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
22: std::rt::lang_start::<()>::{closure#0}
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/rt.rs:49:18
23: std::ops::function::impls::<impl std::ops::FnOnce<()> for &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>::call_once
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:259:13
24: std::panicking::try::do_call::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:379:40
25: std::panicking::try::<i32, &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panicking.rs:343:19
26: std::panic::catch_unwind::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/panic.rs:431:14
27: std::rt::lang_start_internal
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/rt.rs:34:21
28: std::rt::lang_start::<()>
            at /home/hyd-dev/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/rt.rs:48:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.";
    let mut i = 0;
    while i < source.len() {
        unsafe {
            source.get_unchecked(i);
        }
        i += 1;
    }
}

Using [i] to replace get_unchecked() can make it fast again.

@RalfJung
Copy link
Member

Okay, closing as a duplicate of #1367 then.

@RalfJung RalfJung added A-aliasing Area: This affects the aliasing model (Stacked/Tree Borrows) I-slow Impact: Makes Miri even slower than it already is labels Dec 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-aliasing Area: This affects the aliasing model (Stacked/Tree Borrows) I-slow Impact: Makes Miri even slower than it already is
Projects
None yet
Development

No branches or pull requests

3 participants