Skip to content

Commit 6cfaeaf

Browse files
committed
---
yaml --- r: 72605 b: refs/heads/dist-snap c: cc62680 h: refs/heads/master i: 72603: fe90823 v: v3
1 parent d077dd2 commit 6cfaeaf

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
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: b50030718cf28f2a5a81857a26b57442734fe854
10-
refs/heads/dist-snap: 4999d44d5b244671492fbdc05121416e05f729eb
10+
refs/heads/dist-snap: cc62680cc95d2ea733dbdc03c30e5c4c48fdad04
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/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/dist-snap/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)