Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 7c025a8

Browse files
committed
test for forgetting locked mutex
1 parent e5022bf commit 7c025a8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/pass/concurrency/mutex_leak.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// compile-flags: -Zmiri-ignore-leaks
2+
use std::mem;
3+
use std::sync::Mutex;
4+
5+
fn main() {
6+
// Test for https://github.com/rust-lang/rust/issues/85434
7+
let m = Mutex::new(5i32);
8+
mem::forget(m.lock());
9+
}

0 commit comments

Comments
 (0)