From f8dffc6789113a10c9dbf1d815c3569b19b53e96 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Thu, 2 May 2013 19:13:56 -0700 Subject: [PATCH] core: Wire up the unwinder to newsched again This was some merge fallout --- src/libcore/sys.rs | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/libcore/sys.rs b/src/libcore/sys.rs index 215fc95f8c7d7..4a8d9fe27d915 100644 --- a/src/libcore/sys.rs +++ b/src/libcore/sys.rs @@ -204,22 +204,32 @@ impl FailWithCause for &'static str { #[cfg(stage0)] pub fn begin_unwind(msg: ~str, file: ~str, line: uint) -> ! { + do str::as_buf(msg) |msg_buf, _msg_len| { + do str::as_buf(file) |file_buf, _file_len| { + unsafe { + let msg_buf = cast::transmute(msg_buf); + let file_buf = cast::transmute(file_buf); + begin_unwind_(msg_buf, file_buf, line as libc::size_t) + } + } + } +} + +// FIXME #4427: Temporary until rt::rt_fail_ goes away +pub fn begin_unwind_(msg: *c_char, file: *c_char, line: size_t) -> ! { use rt::{context, OldTaskContext}; use rt::local_services::unsafe_borrow_local_services; match context() { OldTaskContext => { - do str::as_buf(msg) |msg_buf, _msg_len| { - do str::as_buf(file) |file_buf, _file_len| { - unsafe { - let msg_buf = cast::transmute(msg_buf); - let file_buf = cast::transmute(file_buf); - begin_unwind_(msg_buf, file_buf, line as libc::size_t) - } - } + unsafe { + gc::cleanup_stack_for_failure(); + rustrt::rust_upcall_fail(msg, file, line); + cast::transmute(()) } } _ => { + // XXX: Need to print the failure message gc::cleanup_stack_for_failure(); unsafe { let local_services = unsafe_borrow_local_services(); @@ -232,15 +242,6 @@ pub fn begin_unwind(msg: ~str, file: ~str, line: uint) -> ! { } } -// FIXME #4427: Temporary until rt::rt_fail_ goes away -pub fn begin_unwind_(msg: *c_char, file: *c_char, line: size_t) -> ! { - unsafe { - gc::cleanup_stack_for_failure(); - rustrt::rust_upcall_fail(msg, file, line); - cast::transmute(()) - } -} - // NOTE: remove function after snapshot #[cfg(stage0)] pub fn fail_assert(msg: &str, file: &str, line: uint) -> ! {