about summary refs log tree commit diff
path: root/src/libstd/rt
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-10-17 18:51:32 -0700
committerAlex Crichton <alex@alexcrichton.com>2013-10-24 14:21:57 -0700
commite117aa0e2a4121aab101cb7526a5e79812bfb76e (patch)
treedd297d5c5cff5bc64d6ed88fc2849cf73e072370 /src/libstd/rt
parent61ed2cfb5516f76487509766b1054275f1340f70 (diff)
downloadrust-e117aa0e2a4121aab101cb7526a5e79812bfb76e.tar.gz
rust-e117aa0e2a4121aab101cb7526a5e79812bfb76e.zip
Stop logging task failure to task loggers
The isn't an ideal patch, and the comment why is in the code. Basically uvio
uses task::unkillable which touches the kill flag for a task, and if the task is
failing due to mismangement of the kill flag, then there will be serious
problems when the task tries to print that it's failing.
Diffstat (limited to 'src/libstd/rt')
-rw-r--r--src/libstd/rt/task.rs18
-rw-r--r--src/libstd/rt/util.rs2
2 files changed, 11 insertions, 9 deletions
diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs
index 16ae28743c5..b3c65ce4749 100644
--- a/src/libstd/rt/task.rs
+++ b/src/libstd/rt/task.rs
@@ -546,7 +546,6 @@ pub fn begin_unwind(msg: *c_char, file: *c_char, line: size_t) -> ! {
     use rt::in_green_task_context;
     use rt::task::Task;
     use rt::local::Local;
-    use rt::logging::Logger;
     use str::Str;
     use c_str::CString;
     use unstable::intrinsics;
@@ -573,16 +572,19 @@ pub fn begin_unwind(msg: *c_char, file: *c_char, line: size_t) -> ! {
         // have been failing due to a lack of memory in the first place...
         let task: *mut Task = Local::unsafe_borrow();
         let n = (*task).name.as_ref().map(|n| n.as_slice()).unwrap_or("<unnamed>");
+
+        // XXX: this should no get forcibly printed to the console, this should
+        //      either be sent to the parent task (ideally), or get printed to
+        //      the task's logger. Right now the logger is actually a uvio
+        //      instance, which uses unkillable blocks internally for various
+        //      reasons. This will cause serious trouble if the task is failing
+        //      due to mismanagment of its own kill flag, so calling our own
+        //      logger in its current state is a bit of a problem.
         match file.as_str() {
             Some(file) => {
-                format_args!(|args| { (*task).logger.log(args) },
-                             "task '{}' failed at '{}', {}:{}",
-                             n, msg, file, line);
-            }
-            None => {
-                format_args!(|args| { (*task).logger.log(args) },
-                             "task '{}' failed at '{}'", n, msg);
+                rterrln!("task '{}' failed at '{}', {}:{}", n, msg, file, line);
             }
+            None => rterrln!("task '{}' failed at '{}'", n, msg),
         }
         if (*task).unwinder.unwinding {
             rtabort!("unwinding again");
diff --git a/src/libstd/rt/util.rs b/src/libstd/rt/util.rs
index f15aa01db95..e859f8e4fdb 100644
--- a/src/libstd/rt/util.rs
+++ b/src/libstd/rt/util.rs
@@ -72,8 +72,8 @@ pub fn default_sched_threads() -> uint {
 pub fn dumb_println(args: &fmt::Arguments) {
     use rt::io::native::stdio::stderr;
     use rt::io::{Writer, io_error, ResourceUnavailable};
-    let mut out = stderr();
 
+    let mut out = stderr();
     let mut again = true;
     do io_error::cond.trap(|e| {
         again = e.kind == ResourceUnavailable;