miri is failing
I figured it could be nice to integrate miri in our ci to catch more potential bugs.
Turned out it's currently failing. Not sure if it's an actual bug or not but it would be good to take a look at some point.
est dict::tests::test_empty_dict ... error: Undefined Behavior: inbounds test failed: 0x0 is not a valid pointer
--> /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/const_ptr.rs:236:18
|
236 | unsafe { intrinsics::offset(self, count) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ inbounds test failed: 0x0 is not a valid pointer
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
= note: inside `std::ptr::const_ptr::<impl *const libspa_sys::spa_dict_item>::offset` at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/const_ptr.rs:236:18
note: inside `<dict::ForeignDict as dict::ReadableDict>::iter_cstr` at libspa/src/dict.rs:19:27
--> libspa/src/dict.rs:19:27
|
19 | end: unsafe { first_elem_ptr.offset((*self.get_dict_ptr()).n_items as isize) },
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `dict::tests::test_empty_dict` at libspa/src/dict.rs:316:20
--> libspa/src/dict.rs:316:20
|
316 | let iter = dict.iter_cstr();
| ^^^^^^^^^^^^^^^^
note: inside closure at libspa/src/dict.rs:308:5
--> libspa/src/dict.rs:308:5
|
308 | / fn test_empty_dict() {
309 | | let raw = spa_dict {
310 | | flags: Flags::empty().bits,
311 | | n_items: 0,
... |
320 | | iter.for_each(|_| panic!("Iterated over non-existing item"));
321 | | }
| |_____^
= note: inside `<[closure@libspa/src/dict.rs:308:5: 321:6] as std::ops::FnOnce<()>>::call_once - shim` at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
= note: inside `<fn() as std::ops::FnOnce<()>>::call_once - shim(fn())` at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
= note: inside `test::__rust_begin_short_backtrace::<fn()>` at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/lib.rs:567:5
= note: inside closure at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/lib.rs:558:30
= note: inside `<[closure@test::run_test::{closure#2}] as std::ops::FnOnce<()>>::call_once - shim(vtable)` at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
= note: inside `<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send> as std::ops::FnOnce<()>>::call_once` at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1546:9
= note: inside `<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>> as std::ops::FnOnce<()>>::call_once` at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:344:9
= note: inside `std::panicking::r#try::do_call::<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>, ()>` at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:379:40
= note: inside `std::panicking::r#try::<(), std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>>` at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:343:19
= note: inside `std::panic::catch_unwind::<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>, ()>` at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:431:14
= note: inside `test::run_test_in_process` at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/lib.rs:589:18
= note: inside closure at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/lib.rs:486:39
= note: inside `test::run_test::run_test_inner` at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/lib.rs:522:13
= note: inside `test::run_test` at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/lib.rs:555:28
= note: inside `test::run_tests::<[closure@test::run_tests_console::{closure#2}]>` at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/lib.rs:301:13
= note: inside `test::run_tests_console` at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/console.rs:289:5
= note: inside `test::test_main` at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/lib.rs:122:15
= note: inside `test::test_main_static` at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/lib.rs:141:5
= note: inside `main`
= note: inside `<fn() as std::ops::FnOnce<()>>::call_once - shim(fn())` at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
= note: inside `std::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>` at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys_common/backtrace.rs:125:18
= note: inside closure at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:66:18
= note: inside `std::ops::function::impls::<impl std::ops::FnOnce<()> for &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>::call_once` at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:259:13
= note: inside `std::panicking::r#try::do_call::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>` at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:379:40
= note: inside `std::panicking::r#try::<i32, &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>` at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:343:19
= note: inside `std::panic::catch_unwind::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>` at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:431:14
= note: inside `std::rt::lang_start_internal` at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:51:25
= note: inside `std::rt::lang_start::<()>` at /usr/local/rustup/toolchains/nightly-2021-03-17-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:65:5
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
error: test failed, to rerun pass '-p libspa --lib'