about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libcore/num/f32.rs2
-rw-r--r--src/libcore/num/f64.rs2
-rw-r--r--src/libcore/num/float.rs2
-rw-r--r--src/libcore/num/int-template.rs4
-rw-r--r--src/libcore/num/uint-template.rs4
-rw-r--r--src/libcore/path.rs4
-rw-r--r--src/libcore/to_str.rs52
-rw-r--r--src/librustc/middle/liveness.rs4
-rw-r--r--src/librustc/middle/trans/closure.rs4
-rw-r--r--src/librustc/middle/trans/common.rs2
-rw-r--r--src/librustc/middle/trans/datum.rs2
-rw-r--r--src/librustc/middle/ty.rs18
-rw-r--r--src/libstd/bigint.rs4
-rw-r--r--src/libstd/bitv.rs2
-rw-r--r--src/libstd/json.rs4
-rw-r--r--src/libstd/net_url.rs4
-rw-r--r--src/libstd/oldmap.rs2
-rw-r--r--src/libsyntax/ast.rs20
-rw-r--r--src/libsyntax/ext/pipes/proto.rs4
-rw-r--r--src/test/auxiliary/cci_class_cast.rs2
-rw-r--r--src/test/compile-fail/issue-3973.rs2
-rw-r--r--src/test/compile-fail/multitrait.rs4
-rw-r--r--src/test/run-pass/class-separate-impl.rs2
-rw-r--r--src/test/run-pass/issue-2904.rs4
-rw-r--r--src/test/run-pass/issue-3563-3.rs2
-rw-r--r--src/test/run-pass/new-impl-syntax.rs4
26 files changed, 88 insertions, 72 deletions
diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs
index 68e7c3c9df2..24ad5c114af 100644
--- a/src/libcore/num/f32.rs
+++ b/src/libcore/num/f32.rs
@@ -439,7 +439,7 @@ pub pure fn to_str_digits(num: f32, dig: uint) -> ~str {
 
 impl f32: to_str::ToStr {
     #[inline(always)]
-    pure fn to_str() -> ~str { to_str_digits(self, 8) }
+    pure fn to_str(&self) -> ~str { to_str_digits(*self, 8) }
 }
 
 impl f32: num::ToStrRadix {
diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs
index 85f44d1b94f..126a48cf280 100644
--- a/src/libcore/num/f64.rs
+++ b/src/libcore/num/f64.rs
@@ -463,7 +463,7 @@ pub pure fn to_str_digits(num: f64, dig: uint) -> ~str {
 
 impl f64: to_str::ToStr {
     #[inline(always)]
-    pure fn to_str() -> ~str { to_str_digits(self, 8) }
+    pure fn to_str(&self) -> ~str { to_str_digits(*self, 8) }
 }
 
 impl f64: num::ToStrRadix {
diff --git a/src/libcore/num/float.rs b/src/libcore/num/float.rs
index 32c77174221..32cda029cd1 100644
--- a/src/libcore/num/float.rs
+++ b/src/libcore/num/float.rs
@@ -206,7 +206,7 @@ pub pure fn to_str_digits(num: float, digits: uint) -> ~str {
 
 impl float: to_str::ToStr {
     #[inline(always)]
-    pure fn to_str() -> ~str { to_str_digits(self, 8) }
+    pure fn to_str(&self) -> ~str { to_str_digits(*self, 8) }
 }
 
 impl float: num::ToStrRadix {
diff --git a/src/libcore/num/int-template.rs b/src/libcore/num/int-template.rs
index 06d11e23967..8b02f3a94c5 100644
--- a/src/libcore/num/int-template.rs
+++ b/src/libcore/num/int-template.rs
@@ -287,8 +287,8 @@ pub pure fn str(i: T) -> ~str { to_str(i) }
 
 impl T : ToStr {
     #[inline(always)]
-    pure fn to_str() -> ~str {
-        to_str(self)
+    pure fn to_str(&self) -> ~str {
+        to_str(*self)
     }
 }
 
diff --git a/src/libcore/num/uint-template.rs b/src/libcore/num/uint-template.rs
index 44ed9816cf9..82c6e017014 100644
--- a/src/libcore/num/uint-template.rs
+++ b/src/libcore/num/uint-template.rs
@@ -249,8 +249,8 @@ pub pure fn str(i: T) -> ~str { to_str(i) }
 
 impl T : ToStr {
     #[inline(always)]
-    pure fn to_str() -> ~str {
-        to_str(self)
+    pure fn to_str(&self) -> ~str {
+        to_str(*self)
     }
 }
 
diff --git a/src/libcore/path.rs b/src/libcore/path.rs
index 2f9b2967775..0b64df8c112 100644
--- a/src/libcore/path.rs
+++ b/src/libcore/path.rs
@@ -368,7 +368,7 @@ impl Path {
 }
 
 impl PosixPath : ToStr {
-    pure fn to_str() -> ~str {
+    pure fn to_str(&self) -> ~str {
         let mut s = ~"";
         if self.is_absolute {
             s += "/";
@@ -531,7 +531,7 @@ impl PosixPath : GenericPath {
 
 
 impl WindowsPath : ToStr {
-    pure fn to_str() -> ~str {
+    pure fn to_str(&self) -> ~str {
         let mut s = ~"";
         match self.host {
           Some(ref h) => { s += "\\\\"; s += *h; }
diff --git a/src/libcore/to_str.rs b/src/libcore/to_str.rs
index 51205b0c647..0e46b4fd004 100644
--- a/src/libcore/to_str.rs
+++ b/src/libcore/to_str.rs
@@ -22,52 +22,68 @@ use kinds::Copy;
 use str;
 use vec;
 
-pub trait ToStr { pub pure fn to_str() -> ~str; }
+pub trait ToStr {
+    pure fn to_str(&self) -> ~str;
+}
 
 impl bool: ToStr {
     #[inline(always)]
-    pure fn to_str() -> ~str { ::bool::to_str(self) }
+    pure fn to_str(&self) -> ~str { ::bool::to_str(*self) }
 }
 impl (): ToStr {
     #[inline(always)]
-    pure fn to_str() -> ~str { ~"()" }
+    pure fn to_str(&self) -> ~str { ~"()" }
 }
 impl ~str: ToStr {
     #[inline(always)]
-    pure fn to_str() -> ~str { copy self }
+    pure fn to_str(&self) -> ~str { copy *self }
 }
 impl &str: ToStr {
     #[inline(always)]
-    pure fn to_str() -> ~str { ::str::from_slice(self) }
+    pure fn to_str(&self) -> ~str { ::str::from_slice(*self) }
 }
 impl @str: ToStr {
     #[inline(always)]
-    pure fn to_str() -> ~str { ::str::from_slice(self) }
+    pure fn to_str(&self) -> ~str { ::str::from_slice(*self) }
 }
 
-impl<A: ToStr Copy, B: ToStr Copy> (A, B): ToStr {
+impl<A: ToStr, B: ToStr> (A, B): ToStr {
     #[inline(always)]
-    pure fn to_str() -> ~str {
-        let (a, b) = self;
-        ~"(" + a.to_str() + ~", " + b.to_str() + ~")"
+    pure fn to_str(&self) -> ~str {
+        // FIXME(#4760): this causes an llvm assertion
+        //let &(ref a, ref b) = self;
+        match *self {
+            (ref a, ref b) => {
+                ~"(" + a.to_str() + ~", " + b.to_str() + ~")"
+            }
+        }
     }
 }
-impl<A: ToStr Copy, B: ToStr Copy, C: ToStr Copy> (A, B, C): ToStr {
+impl<A: ToStr, B: ToStr, C: ToStr> (A, B, C): ToStr {
     #[inline(always)]
-    pure fn to_str() -> ~str {
-        let (a, b, c) = self;
-        ~"(" + a.to_str() + ~", " + b.to_str() + ~", " + c.to_str() + ~")"
+    pure fn to_str(&self) -> ~str {
+        // FIXME(#4760): this causes an llvm assertion
+        //let &(ref a, ref b, ref c) = self;
+        match *self {
+            (ref a, ref b, ref c) => {
+                fmt!("(%s, %s, %s)",
+                    (*a).to_str(),
+                    (*b).to_str(),
+                    (*c).to_str()
+                )
+            }
+        }
     }
 }
 
 impl<A: ToStr> ~[A]: ToStr {
     #[inline(always)]
-    pure fn to_str() -> ~str {
+    pure fn to_str(&self) -> ~str {
         unsafe {
             // Bleh -- not really unsafe
             // push_str and push_char
             let mut acc = ~"[", first = true;
-            for vec::each(self) |elt| {
+            for self.each |elt| {
                 unsafe {
                     if first { first = false; }
                     else { str::push_str(&mut acc, ~", "); }
@@ -82,11 +98,11 @@ impl<A: ToStr> ~[A]: ToStr {
 
 impl<A: ToStr> @A: ToStr {
     #[inline(always)]
-    pure fn to_str() -> ~str { ~"@" + (*self).to_str() }
+    pure fn to_str(&self) -> ~str { ~"@" + (**self).to_str() }
 }
 impl<A: ToStr> ~A: ToStr {
     #[inline(always)]
-    pure fn to_str() -> ~str { ~"~" + (*self).to_str() }
+    pure fn to_str(&self) -> ~str { ~"~" + (**self).to_str() }
 }
 
 #[cfg(test)]
diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs
index d14d58122a7..c13af3a32f2 100644
--- a/src/librustc/middle/liveness.rs
+++ b/src/librustc/middle/liveness.rs
@@ -222,11 +222,11 @@ pub fn check_crate(tcx: ty::ctxt,
 }
 
 impl LiveNode: to_str::ToStr {
-    pure fn to_str() -> ~str { fmt!("ln(%u)", *self) }
+    pure fn to_str(&self) -> ~str { fmt!("ln(%u)", **self) }
 }
 
 impl Variable: to_str::ToStr {
-    pure fn to_str() -> ~str { fmt!("v(%u)", *self) }
+    pure fn to_str(&self) -> ~str { fmt!("v(%u)", **self) }
 }
 
 // ______________________________________________________________________
diff --git a/src/librustc/middle/trans/closure.rs b/src/librustc/middle/trans/closure.rs
index 9a115acbd8d..4cbf6a4f4b7 100644
--- a/src/librustc/middle/trans/closure.rs
+++ b/src/librustc/middle/trans/closure.rs
@@ -121,8 +121,8 @@ pub struct EnvValue {
 }
 
 pub impl EnvAction {
-    fn to_str() -> ~str {
-        match self {
+    fn to_str(&self) -> ~str {
+        match *self {
             EnvCopy => ~"EnvCopy",
             EnvMove => ~"EnvMove",
             EnvRef => ~"EnvRef"
diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs
index f21a3150a1c..571f16e4b34 100644
--- a/src/librustc/middle/trans/common.rs
+++ b/src/librustc/middle/trans/common.rs
@@ -720,7 +720,7 @@ pub impl block {
     fn ty_to_str(t: ty::t) -> ~str {
         ty_to_str(self.tcx(), t)
     }
-    fn to_str() -> ~str {
+    fn to_str(&self) -> ~str {
         match self.node_info {
           Some(node_info) => {
             fmt!("[block %d]", node_info.id)
diff --git a/src/librustc/middle/trans/datum.rs b/src/librustc/middle/trans/datum.rs
index c3bd34ececb..554cebbbcb7 100644
--- a/src/librustc/middle/trans/datum.rs
+++ b/src/librustc/middle/trans/datum.rs
@@ -841,7 +841,7 @@ pub impl DatumBlock {
         self.bcx.tcx()
     }
 
-    fn to_str() -> ~str {
+    fn to_str(&self) -> ~str {
         self.datum.to_str(self.ccx())
     }
 }
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs
index 4a0448c0b24..8610e3c85d7 100644
--- a/src/librustc/middle/ty.rs
+++ b/src/librustc/middle/ty.rs
@@ -667,7 +667,7 @@ pub impl TyVid: Vid {
 }
 
 pub impl TyVid: ToStr {
-    pure fn to_str() -> ~str { fmt!("<V%u>", self.to_uint()) }
+    pure fn to_str(&self) -> ~str { fmt!("<V%u>", self.to_uint()) }
 }
 
 pub impl IntVid: Vid {
@@ -675,7 +675,7 @@ pub impl IntVid: Vid {
 }
 
 pub impl IntVid: ToStr {
-    pure fn to_str() -> ~str { fmt!("<VI%u>", self.to_uint()) }
+    pure fn to_str(&self) -> ~str { fmt!("<VI%u>", self.to_uint()) }
 }
 
 pub impl FloatVid: Vid {
@@ -683,7 +683,7 @@ pub impl FloatVid: Vid {
 }
 
 pub impl FloatVid: ToStr {
-    pure fn to_str() -> ~str { fmt!("<VF%u>", self.to_uint()) }
+    pure fn to_str(&self) -> ~str { fmt!("<VF%u>", self.to_uint()) }
 }
 
 pub impl RegionVid: Vid {
@@ -691,19 +691,19 @@ pub impl RegionVid: Vid {
 }
 
 pub impl RegionVid: ToStr {
-    pure fn to_str() -> ~str { fmt!("%?", self) }
+    pure fn to_str(&self) -> ~str { fmt!("%?", self) }
 }
 
 pub impl FnSig : ToStr {
-    pure fn to_str() -> ~str {
+    pure fn to_str(&self) -> ~str {
         // grr, without tcx not much we can do.
         return ~"(...)";
     }
 }
 
 pub impl InferTy: ToStr {
-    pure fn to_str() -> ~str {
-        match self {
+    pure fn to_str(&self) -> ~str {
+        match *self {
             TyVar(ref v) => v.to_str(),
             IntVar(ref v) => v.to_str(),
             FloatVar(ref v) => v.to_str()
@@ -712,8 +712,8 @@ pub impl InferTy: ToStr {
 }
 
 pub impl IntVarValue : ToStr {
-    pure fn to_str() -> ~str {
-        match self {
+    pure fn to_str(&self) -> ~str {
+        match *self {
             IntType(ref v) => v.to_str(),
             UintType(ref v) => v.to_str(),
         }
diff --git a/src/libstd/bigint.rs b/src/libstd/bigint.rs
index 64126ea918f..092a0d18a0f 100644
--- a/src/libstd/bigint.rs
+++ b/src/libstd/bigint.rs
@@ -88,7 +88,7 @@ impl BigUint : Ord {
 }
 
 impl BigUint : ToStr {
-    pure fn to_str() -> ~str { self.to_str_radix(10) }
+    pure fn to_str(&self) -> ~str { self.to_str_radix(10) }
 }
 
 impl BigUint : from_str::FromStr {
@@ -605,7 +605,7 @@ impl BigInt : Ord {
 }
 
 impl BigInt : ToStr {
-    pure fn to_str() -> ~str { self.to_str_radix(10) }
+    pure fn to_str(&self) -> ~str { self.to_str_radix(10) }
 }
 
 impl BigInt : from_str::FromStr {
diff --git a/src/libstd/bitv.rs b/src/libstd/bitv.rs
index 0ad9d0af2ac..69becd5b9ce 100644
--- a/src/libstd/bitv.rs
+++ b/src/libstd/bitv.rs
@@ -474,7 +474,7 @@ impl Bitv {
      * The resulting string has the same length as `self`, and each
      * character is either '0' or '1'.
      */
-     fn to_str() -> ~str {
+     fn to_str(&self) -> ~str {
        let mut rs = ~"";
        for self.each() |i| { if i { rs += ~"1"; } else { rs += ~"0"; } };
        rs
diff --git a/src/libstd/json.rs b/src/libstd/json.rs
index b9e3b29b152..4b34f318e91 100644
--- a/src/libstd/json.rs
+++ b/src/libstd/json.rs
@@ -1172,11 +1172,11 @@ impl <A: ToJson> Option<A>: ToJson {
 }
 
 impl Json: to_str::ToStr {
-    pure fn to_str() -> ~str { to_str(&self) }
+    pure fn to_str(&self) -> ~str { to_str(self) }
 }
 
 impl Error: to_str::ToStr {
-    pure fn to_str() -> ~str {
+    pure fn to_str(&self) -> ~str {
         fmt!("%u:%u: %s", self.line, self.col, *self.msg)
     }
 }
diff --git a/src/libstd/net_url.rs b/src/libstd/net_url.rs
index 89b19fccc1c..b32c97c6998 100644
--- a/src/libstd/net_url.rs
+++ b/src/libstd/net_url.rs
@@ -718,8 +718,8 @@ pub pure fn to_str(url: &Url) -> ~str {
 }
 
 impl Url: to_str::ToStr {
-    pub pure fn to_str() -> ~str {
-        to_str(&self)
+    pub pure fn to_str(&self) -> ~str {
+        to_str(self)
     }
 }
 
diff --git a/src/libstd/oldmap.rs b/src/libstd/oldmap.rs
index d8fecda73a7..e32043a7225 100644
--- a/src/libstd/oldmap.rs
+++ b/src/libstd/oldmap.rs
@@ -353,7 +353,7 @@ pub mod chained {
     }
 
     impl<K:Eq IterBytes Hash Copy ToStr, V: ToStr Copy> T<K, V>: ToStr {
-        pure fn to_str() -> ~str {
+        pure fn to_str(&self) -> ~str {
             unsafe {
                 // Meh -- this should be safe
                 do io::with_str_writer |wr| { self.to_writer(wr) }
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index a651090cf64..bc808495ca3 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -923,8 +923,8 @@ pub enum trait_method {
 pub enum int_ty { ty_i, ty_char, ty_i8, ty_i16, ty_i32, ty_i64, }
 
 pub impl int_ty : ToStr {
-    pure fn to_str() -> ~str {
-        ::ast_util::int_ty_to_str(self)
+    pure fn to_str(&self) -> ~str {
+        ::ast_util::int_ty_to_str(*self)
     }
 }
 
@@ -959,8 +959,8 @@ pub impl int_ty : cmp::Eq {
 pub enum uint_ty { ty_u, ty_u8, ty_u16, ty_u32, ty_u64, }
 
 pub impl uint_ty : ToStr {
-    pure fn to_str() -> ~str {
-        ::ast_util::uint_ty_to_str(self)
+    pure fn to_str(&self) -> ~str {
+        ::ast_util::uint_ty_to_str(*self)
     }
 }
 
@@ -993,8 +993,8 @@ pub impl uint_ty : cmp::Eq {
 pub enum float_ty { ty_f, ty_f32, ty_f64, }
 
 pub impl float_ty : ToStr {
-    pure fn to_str() -> ~str {
-        ::ast_util::float_ty_to_str(self)
+    pure fn to_str(&self) -> ~str {
+        ::ast_util::float_ty_to_str(*self)
     }
 }
 
@@ -1096,8 +1096,8 @@ pub enum Onceness {
 }
 
 pub impl Onceness : ToStr {
-    pure fn to_str() -> ~str {
-        match self {
+    pure fn to_str(&self) -> ~str {
+        match *self {
             Once => ~"once",
             Many => ~"many"
         }
@@ -1188,8 +1188,8 @@ pub enum purity {
 }
 
 pub impl purity : ToStr {
-    pure fn to_str() -> ~str {
-        match self {
+    pure fn to_str(&self) -> ~str {
+        match *self {
             impure_fn => ~"impure",
             unsafe_fn => ~"unsafe",
             pure_fn => ~"pure",
diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs
index 5c2dd82eb7f..6a1d9357694 100644
--- a/src/libsyntax/ext/pipes/proto.rs
+++ b/src/libsyntax/ext/pipes/proto.rs
@@ -34,8 +34,8 @@ pub impl direction : cmp::Eq {
 }
 
 pub impl direction: ToStr {
-    pure fn to_str() -> ~str {
-        match self {
+    pure fn to_str(&self) -> ~str {
+        match *self {
           send => ~"Send",
           recv => ~"Recv"
         }
diff --git a/src/test/auxiliary/cci_class_cast.rs b/src/test/auxiliary/cci_class_cast.rs
index 1225e2fe8a7..c0140bff5b1 100644
--- a/src/test/auxiliary/cci_class_cast.rs
+++ b/src/test/auxiliary/cci_class_cast.rs
@@ -18,7 +18,7 @@ pub mod kitty {
     }
 
     pub impl cat : ToStr {
-       pure fn to_str() -> ~str { copy self.name }
+       pure fn to_str(&self) -> ~str { copy self.name }
     }
 
     priv impl cat {
diff --git a/src/test/compile-fail/issue-3973.rs b/src/test/compile-fail/issue-3973.rs
index 6c977840c22..5d49610a4e5 100644
--- a/src/test/compile-fail/issue-3973.rs
+++ b/src/test/compile-fail/issue-3973.rs
@@ -20,7 +20,7 @@ impl Point : ToStr { //~ ERROR implements a method not defined in the trait
         Point { x: x, y: y }
     }
 
-    pure fn to_str() -> ~str {
+    pure fn to_str(&self) -> ~str {
         fmt!("(%f, %f)", self.x, self.y)
     }
 }
diff --git a/src/test/compile-fail/multitrait.rs b/src/test/compile-fail/multitrait.rs
index 6fe93c151e6..a0a9e3f0ddf 100644
--- a/src/test/compile-fail/multitrait.rs
+++ b/src/test/compile-fail/multitrait.rs
@@ -14,5 +14,5 @@ struct S {
 
 impl S: Cmp, ToStr { //~ ERROR: expected `{` but found `,`
   fn eq(&&other: S) { false }
-  fn to_str() -> ~str { ~"hi" }
-}
\ No newline at end of file
+  fn to_str(&self) -> ~str { ~"hi" }
+}
diff --git a/src/test/run-pass/class-separate-impl.rs b/src/test/run-pass/class-separate-impl.rs
index 56430678b05..7e59b5d7a87 100644
--- a/src/test/run-pass/class-separate-impl.rs
+++ b/src/test/run-pass/class-separate-impl.rs
@@ -54,7 +54,7 @@ fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
 }
 
 impl cat: ToStr {
-  pure fn to_str() -> ~str { copy self.name }
+  pure fn to_str(&self) -> ~str { copy self.name }
 }
 
 fn print_out<T: ToStr>(thing: T, expected: ~str) {
diff --git a/src/test/run-pass/issue-2904.rs b/src/test/run-pass/issue-2904.rs
index d150cff304a..25d460656fd 100644
--- a/src/test/run-pass/issue-2904.rs
+++ b/src/test/run-pass/issue-2904.rs
@@ -28,8 +28,8 @@ enum square {
 }
 
 impl square: to_str::ToStr {
-    pure fn to_str() -> ~str {
-        match self {
+    pure fn to_str(&self) -> ~str {
+        match *self {
           bot => { ~"R" }
           wall => { ~"#" }
           rock => { ~"*" }
diff --git a/src/test/run-pass/issue-3563-3.rs b/src/test/run-pass/issue-3563-3.rs
index 5196536db62..078bdae314f 100644
--- a/src/test/run-pass/issue-3563-3.rs
+++ b/src/test/run-pass/issue-3563-3.rs
@@ -110,7 +110,7 @@ impl AsciiArt
 // Note that the %s fmt! specifier will not call this automatically.
 impl AsciiArt : ToStr
 {
-    pure fn to_str() -> ~str
+    pure fn to_str(&self) -> ~str
     {
         // Convert each line into a string.
         let lines = do self.lines.map |line| {str::from_chars(*line)};
diff --git a/src/test/run-pass/new-impl-syntax.rs b/src/test/run-pass/new-impl-syntax.rs
index 7966fcea879..aad7ded42d3 100644
--- a/src/test/run-pass/new-impl-syntax.rs
+++ b/src/test/run-pass/new-impl-syntax.rs
@@ -4,7 +4,7 @@ struct Thingy {
 }
 
 impl ToStr for Thingy {
-    pure fn to_str() -> ~str {
+    pure fn to_str(&self) -> ~str {
         fmt!("{ x: %d, y: %d }", self.x, self.y)
     }
 }
@@ -14,7 +14,7 @@ struct PolymorphicThingy<T> {
 }
 
 impl<T:ToStr> ToStr for PolymorphicThingy<T> {
-    pure fn to_str() -> ~str {
+    pure fn to_str(&self) -> ~str {
         self.x.to_str()
     }
 }