Skip to content

Commit

Permalink
Don't check HEAP in miri.
Browse files Browse the repository at this point in the history
  • Loading branch information
Berrysoft committed Jan 22, 2024
1 parent 7c1548d commit 0c59340
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions library/std/src/sys/pal/windows/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ struct Header(*mut u8);
unsafe fn allocate(layout: Layout, zeroed: bool) -> *mut u8 {
// SAFETY: Check the pointer here.
let heap = unsafe { get_process_heap() };
// Initializer is not called in miri, and it's OK to continue with null.
#[cfg(not(miri))]
if heap.is_null() {
// Allocation has failed, could not get the current process heap.
return ptr::null_mut();
Expand Down

0 comments on commit 0c59340

Please sign in to comment.