提交 55c54f0d 编写于 作者: B Brian Anderson

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

I want to use this for std::istr
上级 d6e4fa6b
......@@ -25,8 +25,6 @@
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;
}
......
......@@ -4,6 +4,13 @@
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);
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册