about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libstd/logging.rs7
-rw-r--r--src/libstd/rt/logging.rs24
-rw-r--r--src/libstd/sys.rs5
3 files changed, 18 insertions, 18 deletions
diff --git a/src/libstd/logging.rs b/src/libstd/logging.rs
index 1b91276f904..db5edc2009e 100644
--- a/src/libstd/logging.rs
+++ b/src/libstd/logging.rs
@@ -12,9 +12,8 @@
 
 use option::*;
 use os;
-use either::*;
 use rt;
-use rt::logging::{Logger, StdErrLogger};
+use rt::logging::{Logger, StdErrLogger, OwnedString};
 
 /// Turns on logging to stdout globally
 pub fn console_on() {
@@ -57,12 +56,12 @@ fn newsched_log_str(msg: ~str) {
         match optional_task {
             Some(local) => {
                 // Use the available logger
-                (*local).logger.log(Left(msg));
+                (*local).logger.log(OwnedString(msg));
             }
             None => {
                 // There is no logger anywhere, just write to stderr
                 let mut logger = StdErrLogger;
-                logger.log(Left(msg));
+                logger.log(OwnedString(msg));
             }
         }
     }
diff --git a/src/libstd/rt/logging.rs b/src/libstd/rt/logging.rs
index 0dd096b5bf3..d0bbf5c0506 100644
--- a/src/libstd/rt/logging.rs
+++ b/src/libstd/rt/logging.rs
@@ -7,7 +7,6 @@
 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
-use either::*;
 use libc::{uintptr_t, exit, STDERR_FILENO};
 use option::{Some, None, Option};
 use rt::util::dumb_println;
@@ -168,14 +167,20 @@ fn update_log_settings(crate_map: *u8, settings: ~str) {
     }
 }
 
+/// Represent a string with `Send` bound.
+pub enum SendableString {
+    OwnedString(~str),
+    StaticString(&'static str)
+}
+
 pub trait Logger {
-    fn log(&mut self, msg: Either<~str, &'static str>);
+    fn log(&mut self, msg: SendableString);
 }
 
 pub struct StdErrLogger;
 
 impl Logger for StdErrLogger {
-    fn log(&mut self, msg: Either<~str, &'static str>) {
+    fn log(&mut self, msg: SendableString) {
         use io::{Writer, WriterUtil};
 
         if !should_log_console() {
@@ -183,14 +188,11 @@ impl Logger for StdErrLogger {
         }
 
         let s: &str = match msg {
-            Left(ref s) => {
-                let s: &str = *s;
-                s
-            }
-            Right(ref s) => {
-                let s: &str = *s;
-                s
-            }
+            OwnedString(ref s) => {
+                let slc: &str = *s;
+                slc
+            },
+            StaticString(s) => s,
         };
 
         // Truncate the string
diff --git a/src/libstd/sys.rs b/src/libstd/sys.rs
index c3a5afc1ec8..f7f7fef6fa0 100644
--- a/src/libstd/sys.rs
+++ b/src/libstd/sys.rs
@@ -136,12 +136,11 @@ 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 either::Left;
     use option::{Some, None};
     use rt::in_green_task_context;
     use rt::task::Task;
     use rt::local::Local;
-    use rt::logging::Logger;
+    use rt::logging::{Logger, OwnedString};
     use str::Str;
 
     unsafe {
@@ -164,7 +163,7 @@ pub fn begin_unwind_(msg: *c_char, file: *c_char, line: size_t) -> ! {
                          msg, file, line as int)
                 };
 
-                task.logger.log(Left(msg));
+                task.logger.log(OwnedString(msg));
             }
         } else {
             rterrln!("failed in non-task context at '%s', %s:%i",