Skip to content

Commit 24c8969

Browse files
committed
libcore: Remove the annihilation tests; there's no easy way to make them work.
This should hopefully put out the burning tree.
1 parent ce77335 commit 24c8969

File tree

1 file changed

+6
-54
lines changed

1 file changed

+6
-54
lines changed

src/libcore/cleanup.rs

Lines changed: 6 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use libc::{c_char, c_void, intptr_t, uintptr_t};
22
use ptr::{mut_null, null, to_unsafe_ptr};
33
use repr::BoxRepr;
4-
use rt::rt_free;
54
use sys::TypeDesc;
65
use unsafe::transmute;
76

@@ -67,7 +66,12 @@ struct Task {
6766
* This runs at task death to free all boxes.
6867
*/
6968

70-
unsafe fn do_annihilate() {
69+
/// Destroys all managed memory (i.e. @ boxes) held by the current task.
70+
#[cfg(notest)]
71+
#[lang="annihilate"]
72+
pub unsafe fn annihilate() {
73+
use rt::rt_free;
74+
7175
let task: *Task = transmute(rustrt::rust_get_task());
7276

7377
// Pass 1: Make all boxes immortal.
@@ -105,61 +109,9 @@ unsafe fn do_annihilate() {
105109
}
106110
}
107111

108-
/// Destroys all managed memory (i.e. @ boxes) held by the current task.
109-
#[cfg(notest)]
110-
#[lang="annihilate"]
111-
pub unsafe fn annihilate() {
112-
do_annihilate();
113-
}
114-
115-
#[cfg(test)]
116-
pub unsafe fn annihilate() {
117-
do_annihilate();
118-
}
119-
120112
/// Bindings to the runtime
121113
extern mod rustrt {
122114
#[rust_stack]
123115
/*priv*/ fn rust_get_task() -> *c_void;
124116
}
125117

126-
/*
127-
* Tests
128-
*/
129-
130-
#[cfg(test)]
131-
mod tests {
132-
struct Knot {
133-
mut a: Option<@Knot>
134-
}
135-
136-
struct Blah {
137-
x: int,
138-
drop { io::println("Blah!"); }
139-
}
140-
141-
#[test]
142-
fn test_box_annihilation() {
143-
let knot = @Knot { a: None };
144-
knot.a = Some(knot);
145-
146-
let x = @~"foo";
147-
148-
let blah = @Blah { x: 3 };
149-
150-
let f_ref = @mut None;
151-
let f = || { util::ignore(f_ref); };
152-
*f_ref = Some(f);
153-
154-
unsafe { annihilate(); }
155-
156-
unsafe {
157-
unsafe::forget(knot);
158-
unsafe::forget(x);
159-
unsafe::forget(blah);
160-
unsafe::forget(f_ref);
161-
unsafe::forget(f);
162-
}
163-
}
164-
}
165-

0 commit comments

Comments
 (0)