Skip to content

Commit e35499c

Browse files
committed
Replace remaining uses of deprecated Heap with Global
1 parent 4c8e9b9 commit e35499c

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/test/run-pass/allocator-alloc-one.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010

1111
#![feature(allocator_api, nonnull)]
1212

13-
use std::alloc::{Heap, Alloc};
13+
use std::alloc::{Alloc, Global};
1414

1515
fn main() {
1616
unsafe {
17-
let ptr = Heap.alloc_one::<i32>().unwrap_or_else(|_| {
18-
Heap.oom()
17+
let ptr = Global.alloc_one::<i32>().unwrap_or_else(|_| {
18+
Global.oom()
1919
});
2020
*ptr.as_ptr() = 4;
2121
assert_eq!(*ptr.as_ptr(), 4);
22-
Heap.dealloc_one(ptr);
22+
Global.dealloc_one(ptr);
2323
}
2424
}

src/test/run-pass/regions-mock-trans.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#![feature(allocator_api)]
1414

15-
use std::alloc::{Alloc, Heap, Layout};
15+
use std::alloc::{Alloc, Global, Layout};
1616
use std::ptr::NonNull;
1717

1818
struct arena(());
@@ -32,8 +32,8 @@ struct Ccx {
3232

3333
fn alloc<'a>(_bcx : &'a arena) -> &'a Bcx<'a> {
3434
unsafe {
35-
let ptr = Heap.alloc(Layout::new::<Bcx>())
36-
.unwrap_or_else(|_| Heap.oom());
35+
let ptr = Global.alloc(Layout::new::<Bcx>())
36+
.unwrap_or_else(|_| Global.oom());
3737
&*(ptr.as_ptr() as *const _)
3838
}
3939
}
@@ -46,7 +46,7 @@ fn g(fcx : &Fcx) {
4646
let bcx = Bcx { fcx: fcx };
4747
let bcx2 = h(&bcx);
4848
unsafe {
49-
Heap.dealloc(NonNull::new_unchecked(bcx2 as *const _ as *mut _), Layout::new::<Bcx>());
49+
Global.dealloc(NonNull::new_unchecked(bcx2 as *const _ as *mut _), Layout::new::<Bcx>());
5050
}
5151
}
5252

0 commit comments

Comments
 (0)