Skip to content

running tests under miri fails #26

@matklad

Description

@matklad

Hi! I've tried running the test suite with miri and got the following result:

running 62 tests
error[E0080]: constant evaluation error: stopping looking for borrow being accessed (Alias(None)) because of barrier (88940)
    --> /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/slice/mod.rs:5108:5
     |
5108 |     Repr { raw: FatPtr { data, len } }.rust_mut
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ stopping looking for borrow being accessed (Alias(None)) because of barrier (88940)
     |
error[E0080]: constant evaluation error: stopping looking for borrow being accessed (Alias(None)) because of barrier (38549)
    --> /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/slice/mod.rs:5108:5
     |
5108 |     Repr { raw: FatPtr { data, len } }.rust_mut
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ stopping looking for borrow being accessed (Alias(None)) because of barrier (38549)
     |
     = note: inside call to `std::slice::from_raw_parts_mut::<test::Node>` at /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/liballoc/vec.rs:1712:13
     = note: inside call to `<std::vec::Vec<test::Node> as std::ops::DerefMut>::deref_mut` at /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/liballoc/vec.rs:1026:23
note: inside call to `std::vec::Vec::<test::Node>::push` at src/lib.rs:169:13
    --> src/lib.rs:169:13
     |
169  |             chunks.current.push(value);
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside call to `Arena::<test::Node>::alloc_fast_path` at src/lib.rs:161:9
    --> src/lib.rs:161:9
     |
161  |         self.alloc_fast_path(value)
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside call to `Arena::<test::Node>::alloc` at src/test.rs:24:16
    --> src/test.rs:24:16
     |
24   |         node = arena.alloc(Node(Some(node), 2, DropTracker(&drop_counter)));
     |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside call to `test::arena_as_intended` at src/test.rs:16:1
    --> src/test.rs:16:1
     |
16   | / fn arena_as_intended() {
17   | |     let drop_counter = Cell::new(0);
18   | |     {
19   | |         let arena = Arena::with_capacity(2);
...    |
60   | |     assert_eq!(drop_counter.get(), 7);
61   | | }
     | |_^
     = note: inside call to closure at /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/ops/function.rs:231:5
     = note: inside call to `<[closure@src/test.rs:16:1: 61:2] as std::ops::FnOnce<()>>::call_once - shim` at /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/ops/function.rs:231:5
     = note: inside call to `<fn() as std::ops::FnOnce<()>>::call_once - shim(fn())` at /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libtest/lib.rs:1522:5
     = note: inside call to `test::test::__rust_begin_short_backtrace::<fn()>` at /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libtest/lib.rs:1513:30
     = note: inside call to closure at /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/ops/function.rs:231:5
     = note: inside call to `<[closure@DefId(9/1:109 ~ test[6977]::run_test[0]::{{closure}}[3]) 0:fn()] as std::ops::FnOnce<()>>::call_once - shim` at /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/ops/function.rs:231:5
     = note: inside call to `<[closure@DefId(9/1:109 ~ test[6977]::run_test[0]::{{closure}}[3]) 0:fn()] as std::ops::FnOnce<()>>::call_once - shim(vtable)` at /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/liballoc/boxed.rs:704:9
     = note: inside call to `<std::boxed::Box<dyn std::boxed::FnBox<(), Output = ()> + std::marker::Send> as std::ops::FnOnce<()>>::call_once` at /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panic.rs:309:9
     = note: inside call to `<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::boxed::FnBox<(), Output = ()> + std::marker::Send>> as std::ops::FnOnce<()>>::call_once` at /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:293:40
     = note: inside call to `std::panicking::try::do_call::<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::boxed::FnBox<(), Output = ()> + std::marker::Send>>, ()>` at /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:289:5
     = note: inside call to `std::panicking::try::<(), std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::boxed::FnBox<(), Output = ()> + std::marker::Send>>>` at /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panic.rs:388:9
     = note: inside call to `std::panic::catch_unwind::<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::boxed::FnBox<(), Output = ()> + std::marker::Send>>, ()>` at /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libtest/lib.rs:1468:26
     = note: inside call to closure at /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libtest/lib.rs:1490:13
     = note: inside call to `test::test::run_test::run_test_inner` at /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libtest/lib.rs:1509:28
     = note: inside call to `test::test::run_test` at /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libtest/lib.rs:1167:13
     = note: inside call to `test::test::run_tests::<[closure@DefId(9/1:80 ~ test[6977]::run_tests_console[0]::{{closure}}[2]) 0:&mut test::test::ConsoleTestState, 1:&mut std::boxed::Box<dyn test::test::formatters::OutputFormatter>]>` at /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libtest/lib.rs:972:5
     = note: inside call to `test::test::run_tests_console` at /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libtest/lib.rs:293:15
     = note: inside call to `test::test::test_main` at /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libtest/lib.rs:327:5
     = note: inside call to `test::test::test_main_static`
     = note: inside call to `main` at /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/rt.rs:64:34
     = note: inside call to closure at /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/rt.rs:52:53
     = note: inside call to closure at /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:293:40
     = note: inside call to `std::panicking::try::do_call::<[closure@DefId(1/1:1833 ~ std[c18b]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:289:5
     = note: inside call to `std::panicking::try::<i32, [closure@DefId(1/1:1833 ~ std[c18b]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe]>` at /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panic.rs:388:9
     = note: inside call to `std::panic::catch_unwind::<[closure@DefId(1/1:1833 ~ std[c18b]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/rt.rs:52:25
     = note: inside call to `std::rt::lang_start_internal` at /home/matklad/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/rt.rs:64:5
     = note: inside call to `std::rt::lang_start::<()>`

@RalfJung says that this error means that code invokes UB ^^

EDIT: pasted the wrgon detail initially, updated

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions