about summary refs log tree commit diff
path: root/src/libstd/sys.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-08-08 13:46:40 -0700
committerAlex Crichton <alex@alexcrichton.com>2013-08-28 23:00:46 -0700
commit97f61e7bbeca5c9524126ca75670fc45d1b1a951 (patch)
tree512a4af334395f187b7800b5fd8d5b6358285146 /src/libstd/sys.rs
parent578e68047736167239c52fa1aba0347011ff1bc3 (diff)
Remove @io::Writer from sys/repr/reflect
At the same time, this updates the TyVisitor to use a mutable self because it's
probably going to be mutating state as it goes along anyway.
Diffstat (limited to 'src/libstd/sys.rs')
-rw-r--r--src/libstd/sys.rs15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/libstd/sys.rs b/src/libstd/sys.rs
index cb0753fb2e5..cfc285488a9 100644
--- a/src/libstd/sys.rs
+++ b/src/libstd/sys.rs
@@ -14,6 +14,7 @@
 
 use c_str::ToCStr;
 use cast;
+#[cfg(stage0)]
 use io;
 use libc;
 use libc::{c_char, size_t};
@@ -91,9 +92,19 @@ pub fn refcount<T>(t: @T) -> uint {
     }
 }
 
+#[cfg(not(stage0))]
 pub fn log_str<T>(t: &T) -> ~str {
-    do io::with_str_writer |wr| {
-        repr::write_repr(wr, t)
+    use rt::io;
+    use rt::io::Decorator;
+
+    let mut result = io::mem::MemWriter::new();
+    repr::write_repr(&mut result as &mut io::Writer, t);
+    str::from_bytes_owned(result.inner())
+}
+#[cfg(stage0)]
+pub fn log_str<T>(t: &T) -> ~str {
+    do io::with_str_writer |w| {
+        repr::write_repr(w, t)
     }
 }