Skip to content

Commit 75ea76d

Browse files
committed
Auto merge of #1645 - RalfJung:rustup, r=RalfJung
Rustup; make use of AtomicPtr fixes
2 parents c9a6b23 + 2f0d7d3 commit 75ea76d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3ff10e74a74ed093fcabac1de27fe1cd65bbbb4a
1+
f0f68778f798d6d34649745b41770829b17ba5b8

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1+
use std::{ptr, sync::atomic::{AtomicPtr, Ordering}};
2+
13
static mut LEAKER: Option<Box<Vec<i32>>> = None;
24

35
fn main() {
46
// Having memory "leaked" in globals is allowed.
57
unsafe {
68
LEAKER = Some(Box::new(vec![0; 42]));
79
}
10+
11+
// Make sure this is allowed even when `AtomicPtr` is used.
12+
{
13+
static LEAK: AtomicPtr<usize> = AtomicPtr::new(ptr::null_mut());
14+
LEAK.store(Box::into_raw(Box::new(0usize)), Ordering::SeqCst);
15+
}
816
}

0 commit comments

Comments
 (0)