Skip to content

Test "mem::uninit_write_slice_cloned_no_drop" leaks memory #80116

Closed
@RalfJung

Description

@RalfJung

The test mem::uninit_write_slice_cloned_no_drop added in #79607 leaks memory, which makes a Miri run of the test suite fail:

running 1 test
test mem::uninit_write_slice_cloned_no_drop ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1176 filtered out

The following memory was leaked: alloc1884656 (Rust heap, size: 16, align: 8) {
    01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 │ ................
}

Running Miri on the test suite is helpful to find bugs, so we should avoid deliberate leaks to still be able to detect accidental ones. Can the test be changed to use some other means of ensuring that drop is not called, e.g. with a Bomb type?

struct Bomb;

impl Drop for Bomb {
  fn drop(&mut self) { panic!(); }
}

Cc @drmeepster

Metadata

Metadata

Assignees

Labels

A-testsuiteArea: The testsuite used to check the correctness of rustcC-bugCategory: This is a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions