Skip to content

Commit c8716c4

Browse files
committed
---
yaml --- r: 58694 b: refs/heads/try c: cc62680 h: refs/heads/master v: v3
1 parent efe246a commit c8716c4

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: c081ffbd1e845687202a975ea2e698b623e5722f
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 213f7b24ccd9a6833af7e1a329c5e7ffc8f9e3d2
5-
refs/heads/try: 4999d44d5b244671492fbdc05121416e05f729eb
5+
refs/heads/try: cc62680cc95d2ea733dbdc03c30e5c4c48fdad04
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libcore/cleanup.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use ptr::mut_null;
1515
use repr::BoxRepr;
1616
use sys::TypeDesc;
1717
use cast::transmute;
18+
use unstable::lang::clear_task_borrow_list;
1819

1920
#[cfg(notest)] use ptr::to_unsafe_ptr;
2021

@@ -179,6 +180,10 @@ pub unsafe fn annihilate() {
179180
n_bytes_freed: 0
180181
};
181182

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+
182187
// Pass 1: Make all boxes immortal.
183188
//
184189
// In this pass, nothing gets freed, so it does not matter whether

branches/try/src/libcore/unstable/lang.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,16 @@ fn swap_task_borrow_list(f: &fn(~[BorrowRecord]) -> ~[BorrowRecord]) {
9191
}
9292
}
9393

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) {
95104
debug_ptr("fail_borrowed: ", box);
96105

97106
if !::rt::env::get().debug_borrows {

0 commit comments

Comments
 (0)