Auto merge of #77611 - oli-obk:atomic_miri_leakage, r=nagisa
Directly use raw pointers in `AtomicPtr` store/load I was unable to find any reason for this limitation in the latest source of LLVM or in the documentation [here](http://llvm.org/docs/Atomics.html#libcalls-atomic). fixes https://github.com/rust-lang/miri/issues/1574
This commit is contained in:
commit
f0f68778f7
4 changed files with 73 additions and 30 deletions
|
@ -110,16 +110,6 @@ struct Node {
|
|||
next: *mut Node,
|
||||
}
|
||||
|
||||
#[cfg(miri)]
|
||||
extern "Rust" {
|
||||
/// Miri-provided extern function to mark the block `ptr` points to as a "root"
|
||||
/// for some static memory. This memory and everything reachable by it is not
|
||||
/// considered leaking even if it still exists when the program terminates.
|
||||
///
|
||||
/// `ptr` has to point to the beginning of an allocated block.
|
||||
fn miri_static_root(ptr: *const u8);
|
||||
}
|
||||
|
||||
unsafe fn register_dtor(key: Key, dtor: Dtor) {
|
||||
let mut node = Box::new(Node { key, dtor, next: ptr::null_mut() });
|
||||
|
||||
|
@ -128,9 +118,6 @@ unsafe fn register_dtor(key: Key, dtor: Dtor) {
|
|||
node.next = head;
|
||||
match DTORS.compare_exchange(head, &mut *node, SeqCst, SeqCst) {
|
||||
Ok(_) => {
|
||||
#[cfg(miri)]
|
||||
miri_static_root(&*node as *const _ as *const u8);
|
||||
|
||||
mem::forget(node);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue