Skip to content

Commit 3d151c8

Browse files
committed
leak checker: also test AtomicPtr stored via 'swap'
1 parent 05fcf86 commit 3d151c8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/run-pass/leak-in-static.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,9 @@ fn main() {
1212
{
1313
static LEAK: AtomicPtr<usize> = AtomicPtr::new(ptr::null_mut());
1414
LEAK.store(Box::into_raw(Box::new(0usize)), Ordering::SeqCst);
15+
16+
static LEAK2: AtomicPtr<usize> = AtomicPtr::new(ptr::null_mut());
17+
// Make sure this also works when using 'swap'.
18+
LEAK2.swap(Box::into_raw(Box::new(0usize)), Ordering::SeqCst);
1519
}
1620
}

0 commit comments

Comments
 (0)