You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Vec backing buffer leaks on panic during into_iter #69770
When running the test_into_iter_leak test in Miri, it complains about a memory leak:
note: created allocation with id 228443
--> /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/liballoc/alloc.rs:81:47
|
81 | __rust_alloc(layout.size(), layout.align())
| ^ created allocation with id 228443
|
= note: inside call to `std::alloc::alloc` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/liballoc/alloc.rs:169:22
= note: inside call to `<std::alloc::Global as std::alloc::AllocRef>::alloc` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/liballoc/alloc.rs:203:15
note: inside call to `alloc::alloc::exchange_malloc` at <::alloc::macros::vec macros>:2:46
--> alloc_miri_test/../liballoc/tests/vec.rs:786:13
|
786 | let v = vec![D(false), D(true), D(false)];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside call to `vec::test_into_iter_leak` at alloc_miri_test/../liballoc/tests/vec.rs:769:1
--> alloc_miri_test/../liballoc/tests/vec.rs:769:1
|
769 | / fn test_into_iter_leak() {
770 | | static mut DROPS: i32 = 0;
771 | |
772 | | struct D(bool);
... |
790 | | assert_eq!(unsafe { DROPS }, 3);
791 | | }
| |_^
### LEAK REPORT ###
Alloc 228443: 00 01 00 (3 bytes, alignment 1) (Rust)
Given that the leaked allocation contains "00 01 00", that seems a lot like the backing store of a Vec with initial content D(false), D(true), D(false).
Activity
Rollup merge of rust-lang#69828 - RalfJung:vec-leak, r=kennytm