File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ use ptr::mut_null;
15
15
use repr:: BoxRepr ;
16
16
use sys:: TypeDesc ;
17
17
use cast:: transmute;
18
+ use unstable:: lang:: clear_task_borrow_list;
18
19
19
20
#[ cfg( notest) ] use ptr:: to_unsafe_ptr;
20
21
@@ -179,6 +180,10 @@ pub unsafe fn annihilate() {
179
180
n_bytes_freed : 0
180
181
} ;
181
182
183
+ // Quick hack: we need to free this list upon task exit, and this
184
+ // is a convenient place to do it.
185
+ clear_task_borrow_list ( ) ;
186
+
182
187
// Pass 1: Make all boxes immortal.
183
188
//
184
189
// In this pass, nothing gets freed, so it does not matter whether
Original file line number Diff line number Diff line change @@ -91,7 +91,16 @@ fn swap_task_borrow_list(f: &fn(~[BorrowRecord]) -> ~[BorrowRecord]) {
91
91
}
92
92
}
93
93
94
- pub fn fail_borrowed ( box : * mut BoxRepr , file : * c_char , line : size_t ) {
94
+ pub unsafe fn clear_task_borrow_list ( ) {
95
+ // pub because it is used by the box annihilator.
96
+ let cur_task = rust_get_task ( ) ;
97
+ let ptr = rustrt:: rust_take_task_borrow_list ( cur_task) ;
98
+ if !ptr. is_null ( ) {
99
+ let _: ~[ BorrowRecord ] = transmute ( ptr) ;
100
+ }
101
+ }
102
+
103
+ fn fail_borrowed ( box : * mut BoxRepr , file : * c_char , line : size_t ) {
95
104
debug_ptr ( "fail_borrowed: " , box) ;
96
105
97
106
if !:: rt:: env:: get ( ) . debug_borrows {
You can’t perform that action at this time.
0 commit comments