Promote std::task::rustrt::leak to std::unsafe::leak

I want to use this for std::istr
This commit is contained in:
Brian Anderson 2011-08-22 18:05:34 -07:00
parent d6e4fa6b44
commit 55c54f0db5
2 changed files with 8 additions and 3 deletions

View File

@ -25,8 +25,6 @@ native "rust" mod rustrt {
fn get_task_trampoline() -> u32;
fn migrate_alloc(alloc: *u8, target: task_id);
fn leak<@T>(thing: -T);
}
type rust_task =
@ -149,7 +147,7 @@ fn spawn_inner(thunk: -fn(), notify: option<comm::chan<task_notification>>) ->
rustrt::migrate_alloc(cast(raw_thunk.env), id);
rustrt::start_task(id);
rustrt::leak(thunk);
unsafe::leak(thunk);
ret id;
}

View File

@ -4,6 +4,13 @@ native "rust-intrinsic" mod rusti {
fn cast<T, U>(src: &T) -> U;
}
native "rust" mod rustrt {
fn leak<@T>(thing: -T);
}
// Casts the value at `src` to U. The two types must have the same length.
fn reinterpret_cast<T, U>(src: &T) -> U { ret rusti::cast(src); }
fn leak<@T>(thing: -T) {
rustrt::leak(thing);
}