Miri error: no item granting write access to tag <untagged>
I've been testing my code with seahash dependency with miri, and getting the error on seahash. It also fails on the seahash tests itself:
test buffer::tests::not_equal ... ok
test buffer::tests::pop ... ok
test buffer::tests::position_depedent ... ok
test buffer::tests::push ... ok
test buffer::tests::seq ... ok
test buffer::tests::shakespear ... ok
test buffer::tests::zero ... ignored
test buffer::tests::zero_senitive ... ok
test helper::tests::diffuse_test_vectors ... ok
test helper::tests::read_int_ ... ok
test helper::tests::read_u64_ ... ok
test reference::tests::shakespear ... ok
test stream::tests::chunked_equiv ... error: Undefined Behavior: no item granting write access to tag <untagged> at alloc1020410+0x1 found in borrow stack.
--> /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/intrinsics.rs:1860:14
|
1860 | unsafe { copy_nonoverlapping(src, dst, count) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no item granting write access to tag <untagged> at alloc1020410+0x1 found in borrow stack.
|
= help: this indicates a potential bug in the program: it performed an invalid operation, but the rules it violated are still experimental
= help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
= note: inside `std::intrinsics::copy_nonoverlapping::<u8>` at /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/intrinsics.rs:1860:14
= note: inside `std::ptr::const_ptr::<impl *const u8>::copy_to_nonoverlapping` at /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ptr/const_ptr.rs:808:18
note: inside `stream::SeaHasher::push_bytes` at src/stream.rs:60:13
--> src/stream.rs:60:13
|
60 | ptr.copy_to_nonoverlapping(&mut this[self.ntail], copied);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `<stream::SeaHasher as std::hash::Hasher>::write` at src/stream.rs:168:9
--> src/stream.rs:168:9
|
168 | self.push_bytes(bytes)
| ^^^^^^^^^^^^^^^^^^^^^^
note: inside `stream::tests::chunked_equiv` at src/stream.rs:226:9
--> src/stream.rs:226:9
|
226 | Hasher::write(&mut stream_hasher1, test_buf);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure at src/stream.rs:219:5
--> src/stream.rs:219:5
|
219 | / fn chunked_equiv() {
220 | | let test_buf: &[u8] = &[0xFF, 0xFF, 0xFF, 0xFF,
221 | | 0xFF, 0xFF, 0xFF, 0xFF,
222 | | 0x00, 0x00, 0x00, 0x00,
... |
247 | | assert_eq!(stream_hasher1.finish(), stream_hasher4.finish());
248 | | }
| |_____^
= note: inside `<[closure@src/stream.rs:219:5: 248:6] as std::ops::FnOnce<()>>::call_once - shim` at /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
= note: inside `<fn() as std::ops::FnOnce<()>>::call_once - shim(fn())` at /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
= note: inside `test::__rust_begin_short_backtrace::<fn()>` at /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/test/src/lib.rs:515:5
= note: inside closure at /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/test/src/lib.rs:506:30
= note: inside `<[closure@test::run_test::{closure#2}] as std::ops::FnOnce<()>>::call_once - shim(vtable)` at /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/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 /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1318:9
= note: inside `<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>> as std::ops::FnOnce<()>>::call_once` at /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/panic.rs:322:9
= note: inside `std::panicking::try::do_call::<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>, ()>` at /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/panicking.rs:379:40
= note: inside `std::panicking::try::<(), std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>>` at /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/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 /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/panic.rs:396:14
= note: inside `test::run_test_in_process` at /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/test/src/lib.rs:537:18
= note: inside closure at /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/test/src/lib.rs:448:39
= note: inside `test::run_test::run_test_inner` at /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/test/src/lib.rs:473:13
= note: inside `test::run_test` at /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/test/src/lib.rs:503:28
= note: inside `test::run_tests::<[closure@test::run_tests_console::{closure#2}]>` at /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/test/src/lib.rs:282:13
= note: inside `test::run_tests_console` at /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/test/src/console.rs:280:5
= note: inside `test::test_main` at /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/test/src/lib.rs:120:15
= note: inside `test::test_main_static` at /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/test/src/lib.rs:139:5
= note: inside `main`
= note: inside `<fn() as std::ops::FnOnce<()>>::call_once - shim(fn())` at /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
= note: inside `std::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>` at /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys_common/backtrace.rs:125:18
= note: inside closure at /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/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 /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:259:13
= note: inside `std::panicking::try::do_call::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>` at /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/panicking.rs:379:40
= note: inside `std::panicking::try::<i32, &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>` at /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/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 /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/panic.rs:396:14
= note: inside `std::rt::lang_start_internal` at /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs:51:25
= note: inside `std::rt::lang_start::<()>` at /Users/glebpomykalov/.rustup/toolchains/nightly-x86_64-apple-darwin/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 '--lib'
I'm not quite familiar with the logic behind this unsafe code, but it seems like miri can point to some bug in it.