Skip to content

Commit

Permalink
fixing the test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
blitzerr committed Sep 23, 2020
1 parent 14736ca commit 985dff9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/test/ui/allocator/custom.rs
Expand Up @@ -10,6 +10,7 @@ extern crate helper;

use std::alloc::{self, AllocRef, Global, Layout, System};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::ptr::NonNull;

static HITS: AtomicUsize = AtomicUsize::new(0);

Expand All @@ -23,7 +24,7 @@ unsafe impl alloc::GlobalAlloc for A {

unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
HITS.fetch_add(1, Ordering::SeqCst);
AllocRef::dealloc(&System, ptr, layout)
AllocRef::dealloc(&System, NonNull::new(ptr).unwrap(), layout)
}
}

Expand Down

0 comments on commit 985dff9

Please sign in to comment.