diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-11-05 11:29:45 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-11-10 01:37:11 -0800 |
| commit | aa78c3d6f6b25a0e54f815cd8db765000763e48a (patch) | |
| tree | 45f44d0574eaf91987954e811a02d4010d76c99c /src/libstd/rt | |
| parent | 584b3593485ef144de7217de19ac8a98766c0532 (diff) | |
| download | rust-aa78c3d6f6b25a0e54f815cd8db765000763e48a.tar.gz rust-aa78c3d6f6b25a0e54f815cd8db765000763e48a.zip | |
Clean up the remaining chunks of uv
Diffstat (limited to 'src/libstd/rt')
| -rw-r--r-- | src/libstd/rt/logging.rs | 12 | ||||
| -rw-r--r-- | src/libstd/rt/macros.rs | 7 | ||||
| -rw-r--r-- | src/libstd/rt/task.rs | 9 |
3 files changed, 14 insertions, 14 deletions
diff --git a/src/libstd/rt/logging.rs b/src/libstd/rt/logging.rs index cb66d6f6199..c37195a7b15 100644 --- a/src/libstd/rt/logging.rs +++ b/src/libstd/rt/logging.rs @@ -172,20 +172,18 @@ pub trait Logger { /// This logger emits output to the stderr of the process, and contains a lazily /// initialized event-loop driven handle to the stream. pub struct StdErrLogger { - priv handle: Option<LineBufferedWriter<StdWriter>>, + priv handle: LineBufferedWriter<StdWriter>, } impl StdErrLogger { - pub fn new() -> StdErrLogger { StdErrLogger { handle: None } } + pub fn new() -> StdErrLogger { + StdErrLogger { handle: LineBufferedWriter::new(io::stderr()) } + } } impl Logger for StdErrLogger { fn log(&mut self, args: &fmt::Arguments) { - // First time logging? Get a handle to the stderr of this process. - if self.handle.is_none() { - self.handle = Some(LineBufferedWriter::new(io::stderr())); - } - fmt::writeln(self.handle.get_mut_ref() as &mut io::Writer, args); + fmt::writeln(&mut self.handle as &mut io::Writer, args); } } diff --git a/src/libstd/rt/macros.rs b/src/libstd/rt/macros.rs index c6ff3427c15..2c89bfd8c76 100644 --- a/src/libstd/rt/macros.rs +++ b/src/libstd/rt/macros.rs @@ -34,7 +34,7 @@ macro_rules! rtassert ( ( $arg:expr ) => ( { if ::rt::util::ENFORCE_SANITY { if !$arg { - rtabort!("assertion failed: {}", stringify!($arg)); + rtabort!(" assertion failed: {}", stringify!($arg)); } } } ) @@ -42,7 +42,8 @@ macro_rules! rtassert ( macro_rules! rtabort ( - ($($msg:tt)*) => ( { - ::rt::util::abort(format!($($msg)*)); + ($msg:expr $($arg:tt)*) => ( { + ::rt::util::abort(format!(concat!(file!(), ":", line!(), " ", $msg) + $($arg)*)); } ) ) diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs index cf7c291d189..7e374fc6021 100644 --- a/src/libstd/rt/task.rs +++ b/src/libstd/rt/task.rs @@ -50,7 +50,7 @@ pub struct Task { heap: LocalHeap, priv gc: GarbageCollector, storage: LocalStorage, - logger: StdErrLogger, + logger: Option<StdErrLogger>, unwinder: Unwinder, taskgroup: Option<Taskgroup>, death: Death, @@ -180,7 +180,7 @@ impl Task { heap: LocalHeap::new(), gc: GarbageCollector, storage: LocalStorage(None), - logger: StdErrLogger::new(), + logger: None, unwinder: Unwinder { unwinding: false, cause: None }, taskgroup: None, death: Death::new(), @@ -215,7 +215,7 @@ impl Task { heap: LocalHeap::new(), gc: GarbageCollector, storage: LocalStorage(None), - logger: StdErrLogger::new(), + logger: None, unwinder: Unwinder { unwinding: false, cause: None }, taskgroup: None, death: Death::new(), @@ -238,7 +238,7 @@ impl Task { heap: LocalHeap::new(), gc: GarbageCollector, storage: LocalStorage(None), - logger: StdErrLogger::new(), + logger: None, unwinder: Unwinder { unwinding: false, cause: None }, taskgroup: None, // FIXME(#7544) make watching optional @@ -320,6 +320,7 @@ impl Task { } None => {} } + self.logger.take(); } } |
