@@ -43,15 +43,14 @@ impl<F> DerefMut for OwnedHeap<F> {
43
43
pub fn new_heap ( ) -> OwnedHeap < impl Sized > {
44
44
const HEAP_SIZE : usize = 1000 ;
45
45
let mut heap_space = Box :: new ( Chonk :: < HEAP_SIZE > :: new ( ) ) ;
46
- let data = & mut heap_space. data ;
46
+ let data = & mut Box :: leak ( heap_space) . data ;
47
47
let assumed_location = data. as_mut_ptr ( ) . cast ( ) ;
48
48
49
49
let heap = unsafe { Heap :: new ( data. as_mut_ptr ( ) . cast ( ) , data. len ( ) ) } ;
50
50
assert_eq ! ( heap. bottom( ) , assumed_location) ;
51
51
assert_eq ! ( heap. size( ) , align_down_size( HEAP_SIZE , size_of:: <usize >( ) ) ) ;
52
-
53
52
let drop = move || {
54
- let _ = heap_space;
53
+ // let _ = heap_space;
55
54
} ;
56
55
OwnedHeap { heap, _drop : drop }
57
56
}
@@ -60,7 +59,7 @@ fn new_max_heap() -> OwnedHeap<impl Sized> {
60
59
const HEAP_SIZE : usize = 1024 ;
61
60
const HEAP_SIZE_MAX : usize = 2048 ;
62
61
let mut heap_space = Box :: new ( Chonk :: < HEAP_SIZE_MAX > :: new ( ) ) ;
63
- let data = & mut heap_space. data ;
62
+ let data = & mut Box :: leak ( heap_space) . data ;
64
63
let start_ptr = data. as_mut_ptr ( ) . cast ( ) ;
65
64
66
65
// Unsafe so that we have provenance over the whole allocation.
@@ -69,19 +68,19 @@ fn new_max_heap() -> OwnedHeap<impl Sized> {
69
68
assert_eq ! ( heap. size( ) , HEAP_SIZE ) ;
70
69
71
70
let drop = move || {
72
- let _ = heap_space;
71
+ // let _ = heap_space;
73
72
} ;
74
73
OwnedHeap { heap, _drop : drop }
75
74
}
76
75
77
76
fn new_heap_skip ( ct : usize ) -> OwnedHeap < impl Sized > {
78
77
const HEAP_SIZE : usize = 1000 ;
79
78
let mut heap_space = Box :: new ( Chonk :: < HEAP_SIZE > :: new ( ) ) ;
80
- let data = & mut heap_space. data [ ct..] ;
79
+ let data = & mut Box :: leak ( heap_space) . data [ ct..] ;
81
80
let heap = unsafe { Heap :: new ( data. as_mut_ptr ( ) . cast ( ) , data. len ( ) ) } ;
82
81
83
82
let drop = move || {
84
- let _ = heap_space;
83
+ // let _ = heap_space;
85
84
} ;
86
85
OwnedHeap { heap, _drop : drop }
87
86
}
0 commit comments