about summary refs log tree commit diff
path: root/src/libstd/sys.rs
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2013-06-19 18:37:50 -0700
committerBrian Anderson <banderson@mozilla.com>2013-06-19 18:37:50 -0700
commit391bb0b4e7131cd7d30e03deea3eb9756a7c8954 (patch)
tree6205ff4d378f0e50c7b1e10ecb91b4c542881fa7 /src/libstd/sys.rs
parent5086c0850ebdd8407901d108f312ab141e4a4a18 (diff)
downloadrust-391bb0b4e7131cd7d30e03deea3eb9756a7c8954.tar.gz
rust-391bb0b4e7131cd7d30e03deea3eb9756a7c8954.zip
std: Make newsched failures log correctly
Diffstat (limited to 'src/libstd/sys.rs')
-rw-r--r--src/libstd/sys.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/libstd/sys.rs b/src/libstd/sys.rs
index e49ad348542..f2591996e3a 100644
--- a/src/libstd/sys.rs
+++ b/src/libstd/sys.rs
@@ -180,10 +180,13 @@ impl FailWithCause for &'static str {
 
 // FIXME #4427: Temporary until rt::rt_fail_ goes away
 pub fn begin_unwind_(msg: *c_char, file: *c_char, line: size_t) -> ! {
+    use cell::Cell;
     use option::Option;
+    use either::Left;
     use rt::{context, OldTaskContext, TaskContext};
     use rt::task::{Task, Unwinder};
     use rt::local::Local;
+    use rt::logging::Logger;
 
     let context = context();
     match context {
@@ -200,12 +203,18 @@ pub fn begin_unwind_(msg: *c_char, file: *c_char, line: size_t) -> ! {
                 let msg = str::raw::from_c_str(msg);
                 let file = str::raw::from_c_str(file);
 
-                let outmsg = fmt!("%s at line %i of file %s", msg, line as int, file);
+                let outmsg = fmt!("task failed: '%s' at line %i of file %s",
+                                  msg, line as int, file);
 
                 // XXX: Logging doesn't work correctly in non-task context because it
                 // invokes the local heap
                 if context == TaskContext {
-                    error!(outmsg);
+                    // XXX: Logging doesn't work here - the check to call the log
+                    // function never passes - so calling the log function directly.
+                    let outmsg = Cell::new(outmsg);
+                    do Local::borrow::<Task, ()> |task| {
+                        task.logger.log(Left(outmsg.take()));
+                    }
                 } else {
                     rtdebug!("%s", outmsg);
                 }