Skip to content

Commit

Permalink
Replace remaining uses of deprecated Heap with Global
Browse files Browse the repository at this point in the history
  • Loading branch information
glandium committed Apr 14, 2018
1 parent 4c8e9b9 commit e35499c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/test/run-pass/allocator-alloc-one.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@

#![feature(allocator_api, nonnull)]

use std::alloc::{Heap, Alloc};
use std::alloc::{Alloc, Global};

fn main() {
unsafe {
let ptr = Heap.alloc_one::<i32>().unwrap_or_else(|_| {
Heap.oom()
let ptr = Global.alloc_one::<i32>().unwrap_or_else(|_| {
Global.oom()
});
*ptr.as_ptr() = 4;
assert_eq!(*ptr.as_ptr(), 4);
Heap.dealloc_one(ptr);
Global.dealloc_one(ptr);
}
}
8 changes: 4 additions & 4 deletions src/test/run-pass/regions-mock-trans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#![feature(allocator_api)]

use std::alloc::{Alloc, Heap, Layout};
use std::alloc::{Alloc, Global, Layout};
use std::ptr::NonNull;

struct arena(());
Expand All @@ -32,8 +32,8 @@ struct Ccx {

fn alloc<'a>(_bcx : &'a arena) -> &'a Bcx<'a> {
unsafe {
let ptr = Heap.alloc(Layout::new::<Bcx>())
.unwrap_or_else(|_| Heap.oom());
let ptr = Global.alloc(Layout::new::<Bcx>())
.unwrap_or_else(|_| Global.oom());
&*(ptr.as_ptr() as *const _)
}
}
Expand All @@ -46,7 +46,7 @@ fn g(fcx : &Fcx) {
let bcx = Bcx { fcx: fcx };
let bcx2 = h(&bcx);
unsafe {
Heap.dealloc(NonNull::new_unchecked(bcx2 as *const _ as *mut _), Layout::new::<Bcx>());
Global.dealloc(NonNull::new_unchecked(bcx2 as *const _ as *mut _), Layout::new::<Bcx>());
}
}

Expand Down

0 comments on commit e35499c

Please sign in to comment.