Skip to content

Commit 22001d1

Browse files
committed
Remove hack_allow_leaks
Happy to close the loop on this one. Issue #236
1 parent d267e74 commit 22001d1

File tree

5 files changed

+3
-28
lines changed

5 files changed

+3
-28
lines changed

src/lib/test.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export configure_test_task;
2626
export joinable;
2727

2828
native "rust" mod rustrt {
29-
fn hack_allow_leaks();
3029
fn sched_threads() -> uint;
3130
}
3231

@@ -325,12 +324,6 @@ fn configure_test_task() {
325324
// If this task fails we don't want that failure to propagate to the
326325
// test runner or else we couldn't keep running tests
327326
task::unsupervise();
328-
329-
// FIXME (236): Hack supreme - unwinding doesn't work yet so if this
330-
// task fails memory will not be freed correctly. This turns off the
331-
// sanity checks in the runtime's memory region for the task, so that
332-
// the test runner can continue.
333-
rustrt::hack_allow_leaks();
334327
}
335328

336329
// Local Variables:

src/rt/memory_region.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ memory_region::alloc_header *memory_region::get_header(void *mem) {
1515
memory_region::memory_region(rust_srv *srv, bool synchronized) :
1616
_srv(srv), _parent(NULL), _live_allocations(0),
1717
_detailed_leaks(srv->env->detailed_leaks),
18-
_synchronized(synchronized), _hack_allow_leaks(false) {
18+
_synchronized(synchronized) {
1919
}
2020

2121
memory_region::memory_region(memory_region *parent) :
2222
_srv(parent->_srv), _parent(parent), _live_allocations(0),
2323
_detailed_leaks(parent->_detailed_leaks),
24-
_synchronized(parent->_synchronized), _hack_allow_leaks(false) {
24+
_synchronized(parent->_synchronized) {
2525
}
2626

2727
void memory_region::add_alloc() {
@@ -127,18 +127,13 @@ memory_region::~memory_region() {
127127
assert(leak_count == _live_allocations);
128128
}
129129
#endif
130-
if (!_hack_allow_leaks && _live_allocations > 0) {
130+
if (_live_allocations > 0) {
131131
_srv->fatal(msg, __FILE__, __LINE__,
132132
"%d objects", _live_allocations);
133133
}
134134
if (_synchronized) { _lock.unlock(); }
135135
}
136136

137-
void
138-
memory_region::hack_allow_leaks() {
139-
_hack_allow_leaks = true;
140-
}
141-
142137
void
143138
memory_region::release_alloc(void *mem) {
144139
alloc_header *alloc = get_header(mem);

src/rt/memory_region.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class memory_region {
3232
const bool _detailed_leaks;
3333
const bool _synchronized;
3434
lock_and_signal _lock;
35-
bool _hack_allow_leaks;
3635

3736
void add_alloc();
3837
void dec_alloc();
@@ -46,10 +45,6 @@ class memory_region {
4645
void *realloc(void *mem, size_t size);
4746
void free(void *mem);
4847
virtual ~memory_region();
49-
// FIXME (236: This is a temporary hack to allow failing tasks that leak
50-
// to not kill the entire process, which the test runner needs. Please
51-
// kill with prejudice once unwinding works.
52-
void hack_allow_leaks();
5348

5449
void release_alloc(void *mem);
5550
void claim_alloc(void *mem);

src/rt/rust_builtin.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,6 @@ debug_opaque(rust_task *task, type_desc *t, uint8_t *front)
224224
}
225225
}
226226

227-
extern "C" CDECL void
228-
hack_allow_leaks(rust_task *task)
229-
{
230-
LOG(task, stdlib, "hack_allow_leaks");
231-
task->local_region.hack_allow_leaks();
232-
}
233-
234227
struct rust_box {
235228
RUST_REFCOUNTED(rust_box)
236229

src/rt/rustrt.def.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ get_task_id
2828
get_task_pointer
2929
get_task_trampoline
3030
get_time
31-
hack_allow_leaks
3231
last_os_error
3332
leak
3433
migrate_alloc

0 commit comments

Comments
 (0)