From 55c54f0db5be696be4b27cc23e5948f8eb3acd86 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Mon, 22 Aug 2011 18:05:34 -0700 Subject: [PATCH] Promote std::task::rustrt::leak to std::unsafe::leak I want to use this for std::istr --- src/lib/task.rs | 4 +--- src/lib/unsafe.rs | 7 +++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/lib/task.rs b/src/lib/task.rs index fd971b27477..2e88f12f6c0 100644 --- a/src/lib/task.rs +++ b/src/lib/task.rs @@ -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>) -> rustrt::migrate_alloc(cast(raw_thunk.env), id); rustrt::start_task(id); - rustrt::leak(thunk); + unsafe::leak(thunk); ret id; } diff --git a/src/lib/unsafe.rs b/src/lib/unsafe.rs index 264625cec46..6e1b4b3b7c3 100644 --- a/src/lib/unsafe.rs +++ b/src/lib/unsafe.rs @@ -4,6 +4,13 @@ native "rust-intrinsic" mod rusti { fn cast(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(src: &T) -> U { ret rusti::cast(src); } +fn leak<@T>(thing: -T) { + rustrt::leak(thing); +} \ No newline at end of file