swym
swym copied to clipboard
Undefined Behavior
Running cargo miri test
reports the following UB.
running 20 tests
error[E0080]: Miri evaluation error: trying to reborrow for Unique, but parent tag <93516> does not have an appropriate item in the borrow stack
--> src/internal/alloc/dyn_vec.rs:361:38
|
361 | Some(DynElemMut { value: result })
| ^^^^^^ Miri evaluation error: trying to reborrow for Unique, but parent tag <93516> does not have an appropriate item in the borrow stack
|
note: inside call to `<internal::alloc::dyn_vec::IterMut<dyn internal::alloc::dyn_vec::test::MyAny> as std::iter::Iterator>::next` at src/internal/alloc/dyn_vec.rs:426:9
--> src/internal/alloc/dyn_vec.rs:426:9
|
426 | self.iter.next().map(|DynElemMut { value }| Owned { value })
| ^^^^^^^^^^^^^^^^
note: inside call to `<internal::alloc::dyn_vec::Drain<dyn internal::alloc::dyn_vec::test::MyAny> as std::iter::Iterator>::next` at src/internal/alloc/dyn_vec.rs:550:21
--> src/internal/alloc/dyn_vec.rs:550:21
|
550 | let first = iter.next().unwrap();
| ^^^^^^^^^^^
note: inside call to `internal::alloc::dyn_vec::test::drain` at src/internal/alloc/dyn_vec.rs:530:5
--> src/internal/alloc/dyn_vec.rs:530:5
|
530 | / fn drain() {
531 | | use core::cell::Cell;
532 | |
533 | | thread_local! {
... |
572 | | assert_eq!(DROP_COUNT.with(|x| x.get()), 85);
573 | | }
| |_____^
= note: inside call to closure at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/ops/function.rs:227:5
= note: inside call to `<[closure@src/internal/alloc/dyn_vec.rs:530:5: 573:6] as std::ops::FnOnce<()>>::call_once - shim` at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/ops/function.rs:227:5
= note: inside call to `<fn() as std::ops::FnOnce<()>>::call_once - shim(fn())` at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libtest/lib.rs:1467:5
= note: inside call to `memory::test::__rust_begin_short_backtrace::<fn()>` at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libtest/lib.rs:1458:30
= note: inside call to closure at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/ops/function.rs:227:5
= note: inside call to `<[closure@DefId(38:367 ~ test[b7d9]::run_test[0]::{{closure}}[3]) 0:fn()] as std::ops::FnOnce<()>>::call_once - shim(vtable)` at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/liballoc/boxed.rs:922:9
= note: inside call to `<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send> as std::ops::FnOnce<()>>::call_once` at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panic.rs:315:9
= note: inside call to `<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>> as std::ops::FnOnce<()>>::call_once` at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:292:40
= note: inside call to `std::panicking::try::do_call::<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>, ()>` at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:288:5
= note: inside call to `std::panicking::try::<(), std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>>` at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panic.rs:394:9
= note: inside call to `std::panic::catch_unwind::<std::panic::AssertUnwindSafe<std::boxed::Box<dyn std::ops::FnOnce() + std::marker::Send>>, ()>` at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libtest/lib.rs:1413:26
= note: inside call to closure at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libtest/lib.rs:1435:13
= note: inside call to `memory::test::run_test::run_test_inner` at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libtest/lib.rs:1454:28
= note: inside call to `memory::test::run_test` at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libtest/lib.rs:1107:13
= note: inside call to `memory::test::run_tests::<[closure@DefId(38:316 ~ test[b7d9]::run_tests_console[0]::{{closure}}[2]) 0:&mut memory::test::ConsoleTestState, 1:&mut std::boxed::Box<dyn memory::test::formatters::OutputFormatter>]>` at /home/user/.rustup/toolchains/nightly
-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libtest/lib.rs:957:5
= note: inside call to `memory::test::run_tests_console` at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libtest/lib.rs:295:15
= note: inside call to `memory::test::test_main` at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libtest/lib.rs:329:5
= note: inside call to `memory::test::test_main_static`
= note: inside call to `main` at /home/user/.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/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/rt.rs:49:73
= note: inside call to closure at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/sys_common/backtrace.rs:126:5
= note: inside call to `std::sys_common::backtrace::__rust_begin_short_backtrace::<[closure@DefId(1:6021 ~ std[8641]::rt[0]::lang_start_internal[0]::{{closure}}[0]::{{closure}}[0]) 0:&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/rt.rs:49:13
= note: inside call to closure at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:292:40
= note: inside call to `std::panicking::try::do_call::<[closure@DefId(1:6020 ~ std[8641]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:288:5
= note: inside call to `std::panicking::try::<i32, [closure@DefId(1:6020 ~ std[8641]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe]>` at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panic.rs:394:9
= note: inside call to `std::panic::catch_unwind::<[closure@DefId(1:6020 ~ std[8641]::rt[0]::lang_start_internal[0]::{{closure}}[0]) 0:&&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/rt.rs:48:25
Thank you for this. I'll hopefully be getting back into swym
soon. Glad to see miri is working on swym
.