about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-02-16 07:11:34 -0800
committerbors <bors@rust-lang.org>2014-02-16 07:11:34 -0800
commit0ba6d4885fc71ca7156e1fe689edb939e1d9d418 (patch)
tree157894361cfedb2ef3cd231a6b7b2d144a5db8dd /src
parent6fe775e2b5eaa77dd49c1d9a234c67d52e5f9087 (diff)
parentf450b2b379794ba9f367f9dadbd2d70913da8560 (diff)
downloadrust-0ba6d4885fc71ca7156e1fe689edb939e1d9d418.tar.gz
rust-0ba6d4885fc71ca7156e1fe689edb939e1d9d418.zip
auto merge of #12313 : bjz/rust/tuple, r=huonw
This renames the `n*` and `n*_ref` tuple getters to `val*` and `ref*` respectively, and adds `mut*` getters. It also removes the `CloneableTuple` and `ImmutableTuple` traits.
Diffstat (limited to 'src')
-rw-r--r--src/etc/vim/syntax/rust.vim4
-rw-r--r--src/libcollections/btree.rs8
-rw-r--r--src/libnative/io/process.rs4
-rw-r--r--src/librustc/middle/trans/consts.rs2
-rw-r--r--src/librustc/middle/ty.rs2
-rw-r--r--src/librustdoc/html/render.rs4
-rw-r--r--src/librustdoc/lib.rs2
-rw-r--r--src/libstd/iter.rs2
-rw-r--r--src/libstd/prelude.rs4
-rw-r--r--src/libstd/str.rs6
-rw-r--r--src/libstd/to_str.rs48
-rw-r--r--src/libstd/tuple.rs408
-rw-r--r--src/test/bench/shootout-fasta.rs2
-rw-r--r--src/test/bench/task-perf-alloc-unwind.rs4
14 files changed, 193 insertions, 307 deletions
diff --git a/src/etc/vim/syntax/rust.vim b/src/etc/vim/syntax/rust.vim
index aac759e3950..03c67276049 100644
--- a/src/etc/vim/syntax/rust.vim
+++ b/src/etc/vim/syntax/rust.vim
@@ -95,13 +95,9 @@ syn keyword rustTrait Buffer Writer Reader Seek
 syn keyword rustTrait Str StrVector StrSlice OwnedStr IntoMaybeOwned
 syn keyword rustTrait IterBytes
 syn keyword rustTrait ToStr IntoStr
-syn keyword rustTrait CloneableTuple ImmutableTuple
 syn keyword rustTrait Tuple1 Tuple2 Tuple3 Tuple4
 syn keyword rustTrait Tuple5 Tuple6 Tuple7 Tuple8
 syn keyword rustTrait Tuple9 Tuple10 Tuple11 Tuple12
-syn keyword rustTrait ImmutableTuple1 ImmutableTuple2 ImmutableTuple3 ImmutableTuple4
-syn keyword rustTrait ImmutableTuple5 ImmutableTuple6 ImmutableTuple7 ImmutableTuple8
-syn keyword rustTrait ImmutableTuple9 ImmutableTuple10 ImmutableTuple11 ImmutableTuple12
 syn keyword rustTrait ImmutableEqVector ImmutableTotalOrdVector ImmutableCloneableVector
 syn keyword rustTrait OwnedVector OwnedCloneableVector OwnedEqVector MutableVector
 syn keyword rustTrait Vector VectorVector CloneableVector ImmutableVector
diff --git a/src/libcollections/btree.rs b/src/libcollections/btree.rs
index 34aee6459a8..13b39da0756 100644
--- a/src/libcollections/btree.rs
+++ b/src/libcollections/btree.rs
@@ -500,15 +500,15 @@ impl<K: Clone + TotalOrd, V: Clone> Branch<K, V> {
                     let new_outcome = self.clone().rightmost_child.insert(k.clone(),
                                                                        v.clone(),
                                                                        ub.clone());
-                    new_branch = new_outcome.clone().n0();
-                    outcome = new_outcome.n1();
+                    new_branch = new_outcome.clone().val0();
+                    outcome = new_outcome.val1();
                 }
                 else {
                     let new_outcome = self.clone().elts[index.unwrap()].left.insert(k.clone(),
                                                                                  v.clone(),
                                                                                  ub.clone());
-                    new_branch = new_outcome.clone().n0();
-                    outcome = new_outcome.n1();
+                    new_branch = new_outcome.clone().val0();
+                    outcome = new_outcome.val1();
                 }
                 //Check to see whether a branch or a leaf was returned from the
                 //tree traversal.
diff --git a/src/libnative/io/process.rs b/src/libnative/io/process.rs
index 2a061c5f9b2..b796535371f 100644
--- a/src/libnative/io/process.rs
+++ b/src/libnative/io/process.rs
@@ -529,7 +529,7 @@ fn with_envp<T>(env: Option<~[(~str, ~str)]>, cb: |*c_void| -> T) -> T {
             let mut tmps = vec::with_capacity(env.len());
 
             for pair in env.iter() {
-                let kv = format!("{}={}", pair.first(), pair.second());
+                let kv = format!("{}={}", *pair.ref0(), *pair.ref1());
                 tmps.push(kv.to_c_str());
             }
 
@@ -553,7 +553,7 @@ fn with_envp<T>(env: Option<~[(~str, ~str)]>, cb: |*mut c_void| -> T) -> T {
             let mut blk = ~[];
 
             for pair in env.iter() {
-                let kv = format!("{}={}", pair.first(), pair.second());
+                let kv = format!("{}={}", *pair.ref0(), *pair.ref1());
                 blk.push_all(kv.as_bytes());
                 blk.push(0);
             }
diff --git a/src/librustc/middle/trans/consts.rs b/src/librustc/middle/trans/consts.rs
index 68be851449a..fc5e48a161f 100644
--- a/src/librustc/middle/trans/consts.rs
+++ b/src/librustc/middle/trans/consts.rs
@@ -599,7 +599,7 @@ fn const_expr_unadjusted(cx: @CrateContext, e: &ast::Expr,
                 const_eval::const_uint(i) => i as uint,
                 _ => cx.sess.span_bug(count.span, "count must be integral const expression.")
             };
-            let vs = vec::from_elem(n, const_expr(cx, elem, is_local).first());
+            let vs = vec::from_elem(n, const_expr(cx, elem, is_local).val0());
             let v = if vs.iter().any(|vi| val_ty(*vi) != llunitty) {
                 C_struct(vs, false)
             } else {
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs
index 374f49a36be..0dcbfe491c3 100644
--- a/src/librustc/middle/ty.rs
+++ b/src/librustc/middle/ty.rs
@@ -4604,7 +4604,7 @@ pub fn determine_inherited_purity(parent: (ast::Purity, ast::NodeId),
     // purity inferred for it, then check it under its parent's purity.
     // Otherwise, use its own
     match child_sigil {
-        ast::BorrowedSigil if child.first() == ast::ImpureFn => parent,
+        ast::BorrowedSigil if child.val0() == ast::ImpureFn => parent,
         _ => child
     }
 }
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index c7c4aae35e3..11f80155085 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -1379,11 +1379,11 @@ fn render_methods(w: &mut Writer, it: &clean::Item) -> fmt::Result {
         match c.impls.find(&it.id) {
             Some(v) => {
                 let mut non_trait = v.iter().filter(|p| {
-                    p.n0_ref().trait_.is_none()
+                    p.ref0().trait_.is_none()
                 });
                 let non_trait = non_trait.to_owned_vec();
                 let mut traits = v.iter().filter(|p| {
-                    p.n0_ref().trait_.is_some()
+                    p.ref0().trait_.is_some()
                 });
                 let traits = traits.to_owned_vec();
 
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index e9072fb37bb..24c9d81e530 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -262,7 +262,7 @@ fn rust_input(cratefile: &str, matches: &getopts::Matches) -> Output {
     let mut pm = plugins::PluginManager::new(Path::new(path));
     for pass in passes.iter() {
         let plugin = match PASSES.iter().position(|&(p, _, _)| p == *pass) {
-            Some(i) => PASSES[i].n1(),
+            Some(i) => PASSES[i].val1(),
             None => {
                 error!("unknown pass {}, skipping", *pass);
                 continue
diff --git a/src/libstd/iter.rs b/src/libstd/iter.rs
index d141da68dfd..e5a89fc42e1 100644
--- a/src/libstd/iter.rs
+++ b/src/libstd/iter.rs
@@ -2611,7 +2611,7 @@ mod tests {
         assert_eq!(vi.size_hint(), (10, Some(10)));
 
         assert_eq!(c.take(5).size_hint(), (5, Some(5)));
-        assert_eq!(c.skip(5).size_hint().second(), None);
+        assert_eq!(c.skip(5).size_hint().val1(), None);
         assert_eq!(c.take_while(|_| false).size_hint(), (0, None));
         assert_eq!(c.skip_while(|_| false).size_hint(), (0, None));
         assert_eq!(c.enumerate().size_hint(), (uint::MAX, None));
diff --git a/src/libstd/prelude.rs b/src/libstd/prelude.rs
index 3eaa1db87ba..bd21bb4e754 100644
--- a/src/libstd/prelude.rs
+++ b/src/libstd/prelude.rs
@@ -67,10 +67,6 @@ pub use io::{Buffer, Writer, Reader, Seek};
 pub use str::{Str, StrVector, StrSlice, OwnedStr, IntoMaybeOwned};
 pub use to_bytes::IterBytes;
 pub use to_str::{ToStr, IntoStr};
-pub use tuple::{CloneableTuple, ImmutableTuple};
-pub use tuple::{ImmutableTuple1, ImmutableTuple2, ImmutableTuple3, ImmutableTuple4};
-pub use tuple::{ImmutableTuple5, ImmutableTuple6, ImmutableTuple7, ImmutableTuple8};
-pub use tuple::{ImmutableTuple9, ImmutableTuple10, ImmutableTuple11, ImmutableTuple12};
 pub use tuple::{Tuple1, Tuple2, Tuple3, Tuple4};
 pub use tuple::{Tuple5, Tuple6, Tuple7, Tuple8};
 pub use tuple::{Tuple9, Tuple10, Tuple11, Tuple12};
diff --git a/src/libstd/str.rs b/src/libstd/str.rs
index 023900e5d41..0a7f513581c 100644
--- a/src/libstd/str.rs
+++ b/src/libstd/str.rs
@@ -567,14 +567,14 @@ impl<'a> Iterator<&'a str> for StrSplits<'a> {
 // Helper functions used for Unicode normalization
 fn canonical_sort(comb: &mut [(char, u8)]) {
     use iter::range;
-    use tuple::CloneableTuple;
+    use tuple::Tuple2;
 
     let len = comb.len();
     for i in range(0, len) {
         let mut swapped = false;
         for j in range(1, len-i) {
-            let classA = comb[j-1].second();
-            let classB = comb[j].second();
+            let classA = *comb[j-1].ref1();
+            let classB = *comb[j].ref1();
             if classA != 0 && classB != 0 && classA > classB {
                 comb.swap(j-1, j);
                 swapped = true;
diff --git a/src/libstd/to_str.rs b/src/libstd/to_str.rs
index 87d59f09791..ab14e9f5667 100644
--- a/src/libstd/to_str.rs
+++ b/src/libstd/to_str.rs
@@ -40,17 +40,6 @@ impl ToStr for () {
     fn to_str(&self) -> ~str { ~"()" }
 }
 
-impl<A:ToStr> ToStr for (A,) {
-    #[inline]
-    fn to_str(&self) -> ~str {
-        match *self {
-            (ref a,) => {
-                format!("({},)", (*a).to_str())
-            }
-        }
-    }
-}
-
 impl<A:ToStr+Hash+Eq, B:ToStr> ToStr for HashMap<A, B> {
     #[inline]
     fn to_str(&self) -> ~str {
@@ -91,36 +80,6 @@ impl<A:ToStr+Hash+Eq> ToStr for HashSet<A> {
     }
 }
 
-impl<A:ToStr,B:ToStr> ToStr for (A, B) {
-    #[inline]
-    fn to_str(&self) -> ~str {
-        // FIXME(#4653): this causes an llvm assertion
-        //let &(ref a, ref b) = self;
-        match *self {
-            (ref a, ref b) => {
-                format!("({}, {})", (*a).to_str(), (*b).to_str())
-            }
-        }
-    }
-}
-
-impl<A:ToStr,B:ToStr,C:ToStr> ToStr for (A, B, C) {
-    #[inline]
-    fn to_str(&self) -> ~str {
-        // FIXME(#4653): this causes an llvm assertion
-        //let &(ref a, ref b, ref c) = self;
-        match *self {
-            (ref a, ref b, ref c) => {
-                format!("({}, {}, {})",
-                    (*a).to_str(),
-                    (*b).to_str(),
-                    (*c).to_str()
-                )
-            }
-        }
-    }
-}
-
 impl<'a,A:ToStr> ToStr for &'a [A] {
     #[inline]
     fn to_str(&self) -> ~str {
@@ -179,13 +138,6 @@ mod tests {
     }
 
     #[test]
-    fn test_tuple_types() {
-        assert_eq!((1, 2).to_str(), ~"(1, 2)");
-        assert_eq!((~"a", ~"b", false).to_str(), ~"(a, b, false)");
-        assert_eq!(((), ((), 100)).to_str(), ~"((), ((), 100))");
-    }
-
-    #[test]
     fn test_vectors() {
         let x: ~[int] = ~[];
         assert_eq!(x.to_str(), ~"[]");
diff --git a/src/libstd/tuple.rs b/src/libstd/tuple.rs
index 33d23df242c..7a81e69f30a 100644
--- a/src/libstd/tuple.rs
+++ b/src/libstd/tuple.rs
@@ -15,109 +15,51 @@
 use clone::Clone;
 #[cfg(not(test))] use cmp::*;
 #[cfg(not(test))] use default::Default;
-
-/// Method extensions to pairs where both types satisfy the `Clone` bound
-pub trait CloneableTuple<T, U> {
-    /// Return the first element of self
-    fn first(&self) -> T;
-    /// Return the second element of self
-    fn second(&self) -> U;
-    /// Return the results of swapping the two elements of self
-    fn swap(&self) -> (U, T);
-}
-
-impl<T:Clone,U:Clone> CloneableTuple<T, U> for (T, U) {
-    /// Return the first element of self
-    #[inline]
-    fn first(&self) -> T {
-        match *self {
-            (ref t, _) => (*t).clone(),
-        }
-    }
-
-    /// Return the second element of self
-    #[inline]
-    fn second(&self) -> U {
-        match *self {
-            (_, ref u) => (*u).clone(),
-        }
-    }
-
-    /// Return the results of swapping the two elements of self
-    #[inline]
-    fn swap(&self) -> (U, T) {
-        match (*self).clone() {
-            (t, u) => (u, t),
-        }
-    }
-}
-
-/// Method extensions for pairs where the types don't necessarily satisfy the
-/// `Clone` bound
-pub trait ImmutableTuple<T, U> {
-    /// Return a reference to the first element of self
-    fn first_ref<'a>(&'a self) -> &'a T;
-    /// Return a reference to the second element of self
-    fn second_ref<'a>(&'a self) -> &'a U;
-}
-
-impl<T, U> ImmutableTuple<T, U> for (T, U) {
-    #[inline]
-    fn first_ref<'a>(&'a self) -> &'a T {
-        match *self {
-            (ref t, _) => t,
-        }
-    }
-    #[inline]
-    fn second_ref<'a>(&'a self) -> &'a U {
-        match *self {
-            (_, ref u) => u,
-        }
-    }
-}
+use fmt;
+use result::{Ok, Err};
+use to_str::ToStr;
 
 // macro for implementing n-ary tuple functions and operations
-
 macro_rules! tuple_impls {
     ($(
-        ($move_trait:ident, $immutable_trait:ident) {
-            $(($get_fn:ident, $get_ref_fn:ident) -> $T:ident {
-                $move_pattern:pat, $ref_pattern:pat => $ret:expr
+        $Tuple:ident {
+            $(($valN:ident, $refN:ident, $mutN:ident) -> $T:ident {
+                ($($x:ident),+) => $ret:expr
             })+
         }
     )+) => {
         $(
-            pub trait $move_trait<$($T),+> {
-                $(fn $get_fn(self) -> $T;)+
+            pub trait $Tuple<$($T),+> {
+                $(fn $valN(self) -> $T;)+
+                $(fn $refN<'a>(&'a self) -> &'a $T;)+
+                $(fn $mutN<'a>(&'a mut self) -> &'a mut $T;)+
             }
 
-            impl<$($T),+> $move_trait<$($T),+> for ($($T,)+) {
+            impl<$($T),+> $Tuple<$($T),+> for ($($T,)+) {
                 $(
                     #[inline]
-                    fn $get_fn(self) -> $T {
-                        let $move_pattern = self;
-                        $ret
+                    #[allow(unused_variable)]
+                    fn $valN(self) -> $T {
+                        let ($($x,)+) = self; $ret
                     }
-                )+
-            }
 
-            pub trait $immutable_trait<$($T),+> {
-                $(fn $get_ref_fn<'a>(&'a self) -> &'a $T;)+
-            }
+                    #[inline]
+                    #[allow(unused_variable)]
+                    fn $refN<'a>(&'a self) -> &'a $T {
+                        let ($(ref $x,)+) = *self; $ret
+                    }
 
-            impl<$($T),+> $immutable_trait<$($T),+> for ($($T,)+) {
-                $(
                     #[inline]
-                    fn $get_ref_fn<'a>(&'a self) -> &'a $T {
-                        let $ref_pattern = *self;
-                        $ret
+                    #[allow(unused_variable)]
+                    fn $mutN<'a>(&'a mut self) -> &'a mut $T {
+                        let ($(ref mut $x,)+) = *self; $ret
                     }
                 )+
             }
 
             impl<$($T:Clone),+> Clone for ($($T,)+) {
                 fn clone(&self) -> ($($T,)+) {
-                    ($(self.$get_ref_fn().clone(),)+)
+                    ($(self.$refN().clone(),)+)
                 }
             }
 
@@ -125,11 +67,11 @@ macro_rules! tuple_impls {
             impl<$($T:Eq),+> Eq for ($($T,)+) {
                 #[inline]
                 fn eq(&self, other: &($($T,)+)) -> bool {
-                    $(*self.$get_ref_fn() == *other.$get_ref_fn())&&+
+                    $(*self.$refN() == *other.$refN())&&+
                 }
                 #[inline]
                 fn ne(&self, other: &($($T,)+)) -> bool {
-                    $(*self.$get_ref_fn() != *other.$get_ref_fn())||+
+                    $(*self.$refN() != *other.$refN())||+
                 }
             }
 
@@ -137,7 +79,7 @@ macro_rules! tuple_impls {
             impl<$($T:TotalEq),+> TotalEq for ($($T,)+) {
                 #[inline]
                 fn equals(&self, other: &($($T,)+)) -> bool {
-                    $(self.$get_ref_fn().equals(other.$get_ref_fn()))&&+
+                    $(self.$refN().equals(other.$refN()))&&+
                 }
             }
 
@@ -145,19 +87,19 @@ macro_rules! tuple_impls {
             impl<$($T:Ord + Eq),+> Ord for ($($T,)+) {
                 #[inline]
                 fn lt(&self, other: &($($T,)+)) -> bool {
-                    lexical_ord!(lt, $(self.$get_ref_fn(), other.$get_ref_fn()),+)
+                    lexical_ord!(lt, $(self.$refN(), other.$refN()),+)
                 }
                 #[inline]
                 fn le(&self, other: &($($T,)+)) -> bool {
-                    lexical_ord!(le, $(self.$get_ref_fn(), other.$get_ref_fn()),+)
+                    lexical_ord!(le, $(self.$refN(), other.$refN()),+)
                 }
                 #[inline]
                 fn ge(&self, other: &($($T,)+)) -> bool {
-                    lexical_ord!(ge, $(self.$get_ref_fn(), other.$get_ref_fn()),+)
+                    lexical_ord!(ge, $(self.$refN(), other.$refN()),+)
                 }
                 #[inline]
                 fn gt(&self, other: &($($T,)+)) -> bool {
-                    lexical_ord!(gt, $(self.$get_ref_fn(), other.$get_ref_fn()),+)
+                    lexical_ord!(gt, $(self.$refN(), other.$refN()),+)
                 }
             }
 
@@ -165,7 +107,7 @@ macro_rules! tuple_impls {
             impl<$($T:TotalOrd),+> TotalOrd for ($($T,)+) {
                 #[inline]
                 fn cmp(&self, other: &($($T,)+)) -> Ordering {
-                    lexical_cmp!($(self.$get_ref_fn(), other.$get_ref_fn()),+)
+                    lexical_cmp!($(self.$refN(), other.$refN()),+)
                 }
             }
 
@@ -176,6 +118,18 @@ macro_rules! tuple_impls {
                     ($({ let x: $T = Default::default(); x},)+)
                 }
             }
+
+            impl<$($T: fmt::Show),+> ToStr for ($($T,)+) {
+                fn to_str(&self) -> ~str {
+                    format!("{}", *self)
+                }
+            }
+
+            impl<$($T: fmt::Show),+> fmt::Show for ($($T,)+) {
+                fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+                    write_tuple!(f.buf, $(self.$refN()),+)
+                }
+            }
         )+
     }
 }
@@ -202,120 +156,120 @@ macro_rules! lexical_cmp {
     ($a:expr, $b:expr) => { ($a).cmp($b) };
 }
 
+macro_rules! write_tuple {
+    ($buf:expr, $x:expr) => (
+        write!($buf, "({},)", *$x)
+    );
+    ($buf:expr, $hd:expr, $($tl:expr),+) => ({
+        if_ok!(write!($buf, "("));
+        if_ok!(write!($buf, "{}", *$hd));
+        $(if_ok!(write!($buf, ", {}", *$tl));)+
+        write!($buf, ")")
+    });
+}
 
 tuple_impls! {
-    (Tuple1, ImmutableTuple1) {
-        (n0, n0_ref) -> A { (a,), (ref a,) => a }
+    Tuple1 {
+        (val0, ref0, mut0) -> A { (a) => a }
     }
-
-    (Tuple2, ImmutableTuple2) {
-        (n0, n0_ref) -> A { (a,_), (ref a,_) => a }
-        (n1, n1_ref) -> B { (_,b), (_,ref b) => b }
+    Tuple2 {
+        (val0, ref0, mut0) -> A { (a, b) => a }
+        (val1, ref1, mut1) -> B { (a, b) => b }
     }
-
-    (Tuple3, ImmutableTuple3) {
-        (n0, n0_ref) -> A { (a,_,_), (ref a,_,_) => a }
-        (n1, n1_ref) -> B { (_,b,_), (_,ref b,_) => b }
-        (n2, n2_ref) -> C { (_,_,c), (_,_,ref c) => c }
+    Tuple3 {
+        (val0, ref0, mut0) -> A { (a, b, c) => a }
+        (val1, ref1, mut1) -> B { (a, b, c) => b }
+        (val2, ref2, mut2) -> C { (a, b, c) => c }
     }
-
-    (Tuple4, ImmutableTuple4) {
-        (n0, n0_ref) -> A { (a,_,_,_), (ref a,_,_,_) => a }
-        (n1, n1_ref) -> B { (_,b,_,_), (_,ref b,_,_) => b }
-        (n2, n2_ref) -> C { (_,_,c,_), (_,_,ref c,_) => c }
-        (n3, n3_ref) -> D { (_,_,_,d), (_,_,_,ref d) => d }
+    Tuple4 {
+        (val0, ref0, mut0) -> A { (a, b, c, d) => a }
+        (val1, ref1, mut1) -> B { (a, b, c, d) => b }
+        (val2, ref2, mut2) -> C { (a, b, c, d) => c }
+        (val3, ref3, mut3) -> D { (a, b, c, d) => d }
     }
-
-    (Tuple5, ImmutableTuple5) {
-        (n0, n0_ref) -> A { (a,_,_,_,_), (ref a,_,_,_,_) => a }
-        (n1, n1_ref) -> B { (_,b,_,_,_), (_,ref b,_,_,_) => b }
-        (n2, n2_ref) -> C { (_,_,c,_,_), (_,_,ref c,_,_) => c }
-        (n3, n3_ref) -> D { (_,_,_,d,_), (_,_,_,ref d,_) => d }
-        (n4, n4_ref) -> E { (_,_,_,_,e), (_,_,_,_,ref e) => e }
+    Tuple5 {
+        (val0, ref0, mut0) -> A { (a, b, c, d, e) => a }
+        (val1, ref1, mut1) -> B { (a, b, c, d, e) => b }
+        (val2, ref2, mut2) -> C { (a, b, c, d, e) => c }
+        (val3, ref3, mut3) -> D { (a, b, c, d, e) => d }
+        (val4, ref4, mut4) -> E { (a, b, c, d, e) => e }
     }
-
-    (Tuple6, ImmutableTuple6) {
-        (n0, n0_ref) -> A { (a,_,_,_,_,_), (ref a,_,_,_,_,_) => a }
-        (n1, n1_ref) -> B { (_,b,_,_,_,_), (_,ref b,_,_,_,_) => b }
-        (n2, n2_ref) -> C { (_,_,c,_,_,_), (_,_,ref c,_,_,_) => c }
-        (n3, n3_ref) -> D { (_,_,_,d,_,_), (_,_,_,ref d,_,_) => d }
-        (n4, n4_ref) -> E { (_,_,_,_,e,_), (_,_,_,_,ref e,_) => e }
-        (n5, n5_ref) -> F { (_,_,_,_,_,f), (_,_,_,_,_,ref f) => f }
+    Tuple6 {
+        (val0, ref0, mut0) -> A { (a, b, c, d, e, f) => a }
+        (val1, ref1, mut1) -> B { (a, b, c, d, e, f) => b }
+        (val2, ref2, mut2) -> C { (a, b, c, d, e, f) => c }
+        (val3, ref3, mut3) -> D { (a, b, c, d, e, f) => d }
+        (val4, ref4, mut4) -> E { (a, b, c, d, e, f) => e }
+        (val5, ref5, mut5) -> F { (a, b, c, d, e, f) => f }
     }
-
-    (Tuple7, ImmutableTuple7) {
-        (n0, n0_ref) -> A { (a,_,_,_,_,_,_), (ref a,_,_,_,_,_,_) => a }
-        (n1, n1_ref) -> B { (_,b,_,_,_,_,_), (_,ref b,_,_,_,_,_) => b }
-        (n2, n2_ref) -> C { (_,_,c,_,_,_,_), (_,_,ref c,_,_,_,_) => c }
-        (n3, n3_ref) -> D { (_,_,_,d,_,_,_), (_,_,_,ref d,_,_,_) => d }
-        (n4, n4_ref) -> E { (_,_,_,_,e,_,_), (_,_,_,_,ref e,_,_) => e }
-        (n5, n5_ref) -> F { (_,_,_,_,_,f,_), (_,_,_,_,_,ref f,_) => f }
-        (n6, n6_ref) -> G { (_,_,_,_,_,_,g), (_,_,_,_,_,_,ref g) => g }
+    Tuple7 {
+        (val0, ref0, mut0) -> A { (a, b, c, d, e, f, g) => a }
+        (val1, ref1, mut1) -> B { (a, b, c, d, e, f, g) => b }
+        (val2, ref2, mut2) -> C { (a, b, c, d, e, f, g) => c }
+        (val3, ref3, mut3) -> D { (a, b, c, d, e, f, g) => d }
+        (val4, ref4, mut4) -> E { (a, b, c, d, e, f, g) => e }
+        (val5, ref5, mut5) -> F { (a, b, c, d, e, f, g) => f }
+        (val6, ref6, mut6) -> G { (a, b, c, d, e, f, g) => g }
     }
-
-    (Tuple8, ImmutableTuple8) {
-        (n0, n0_ref) -> A { (a,_,_,_,_,_,_,_), (ref a,_,_,_,_,_,_,_) => a }
-        (n1, n1_ref) -> B { (_,b,_,_,_,_,_,_), (_,ref b,_,_,_,_,_,_) => b }
-        (n2, n2_ref) -> C { (_,_,c,_,_,_,_,_), (_,_,ref c,_,_,_,_,_) => c }
-        (n3, n3_ref) -> D { (_,_,_,d,_,_,_,_), (_,_,_,ref d,_,_,_,_) => d }
-        (n4, n4_ref) -> E { (_,_,_,_,e,_,_,_), (_,_,_,_,ref e,_,_,_) => e }
-        (n5, n5_ref) -> F { (_,_,_,_,_,f,_,_), (_,_,_,_,_,ref f,_,_) => f }
-        (n6, n6_ref) -> G { (_,_,_,_,_,_,g,_), (_,_,_,_,_,_,ref g,_) => g }
-        (n7, n7_ref) -> H { (_,_,_,_,_,_,_,h), (_,_,_,_,_,_,_,ref h) => h }
+    Tuple8 {
+        (val0, ref0, mut0) -> A { (a, b, c, d, e, f, g, h) => a }
+        (val1, ref1, mut1) -> B { (a, b, c, d, e, f, g, h) => b }
+        (val2, ref2, mut2) -> C { (a, b, c, d, e, f, g, h) => c }
+        (val3, ref3, mut3) -> D { (a, b, c, d, e, f, g, h) => d }
+        (val4, ref4, mut4) -> E { (a, b, c, d, e, f, g, h) => e }
+        (val5, ref5, mut5) -> F { (a, b, c, d, e, f, g, h) => f }
+        (val6, ref6, mut6) -> G { (a, b, c, d, e, f, g, h) => g }
+        (val7, ref7, mut7) -> H { (a, b, c, d, e, f, g, h) => h }
     }
-
-    (Tuple9, ImmutableTuple9) {
-        (n0, n0_ref) -> A { (a,_,_,_,_,_,_,_,_), (ref a,_,_,_,_,_,_,_,_) => a }
-        (n1, n1_ref) -> B { (_,b,_,_,_,_,_,_,_), (_,ref b,_,_,_,_,_,_,_) => b }
-        (n2, n2_ref) -> C { (_,_,c,_,_,_,_,_,_), (_,_,ref c,_,_,_,_,_,_) => c }
-        (n3, n3_ref) -> D { (_,_,_,d,_,_,_,_,_), (_,_,_,ref d,_,_,_,_,_) => d }
-        (n4, n4_ref) -> E { (_,_,_,_,e,_,_,_,_), (_,_,_,_,ref e,_,_,_,_) => e }
-        (n5, n5_ref) -> F { (_,_,_,_,_,f,_,_,_), (_,_,_,_,_,ref f,_,_,_) => f }
-        (n6, n6_ref) -> G { (_,_,_,_,_,_,g,_,_), (_,_,_,_,_,_,ref g,_,_) => g }
-        (n7, n7_ref) -> H { (_,_,_,_,_,_,_,h,_), (_,_,_,_,_,_,_,ref h,_) => h }
-        (n8, n8_ref) -> I { (_,_,_,_,_,_,_,_,i), (_,_,_,_,_,_,_,_,ref i) => i }
+    Tuple9 {
+        (val0, ref0, mut0) -> A { (a, b, c, d, e, f, g, h, i) => a }
+        (val1, ref1, mut1) -> B { (a, b, c, d, e, f, g, h, i) => b }
+        (val2, ref2, mut2) -> C { (a, b, c, d, e, f, g, h, i) => c }
+        (val3, ref3, mut3) -> D { (a, b, c, d, e, f, g, h, i) => d }
+        (val4, ref4, mut4) -> E { (a, b, c, d, e, f, g, h, i) => e }
+        (val5, ref5, mut5) -> F { (a, b, c, d, e, f, g, h, i) => f }
+        (val6, ref6, mut6) -> G { (a, b, c, d, e, f, g, h, i) => g }
+        (val7, ref7, mut7) -> H { (a, b, c, d, e, f, g, h, i) => h }
+        (val8, ref8, mut8) -> I { (a, b, c, d, e, f, g, h, i) => i }
     }
-
-    (Tuple10, ImmutableTuple10) {
-        (n0, n0_ref) -> A { (a,_,_,_,_,_,_,_,_,_), (ref a,_,_,_,_,_,_,_,_,_) => a }
-        (n1, n1_ref) -> B { (_,b,_,_,_,_,_,_,_,_), (_,ref b,_,_,_,_,_,_,_,_) => b }
-        (n2, n2_ref) -> C { (_,_,c,_,_,_,_,_,_,_), (_,_,ref c,_,_,_,_,_,_,_) => c }
-        (n3, n3_ref) -> D { (_,_,_,d,_,_,_,_,_,_), (_,_,_,ref d,_,_,_,_,_,_) => d }
-        (n4, n4_ref) -> E { (_,_,_,_,e,_,_,_,_,_), (_,_,_,_,ref e,_,_,_,_,_) => e }
-        (n5, n5_ref) -> F { (_,_,_,_,_,f,_,_,_,_), (_,_,_,_,_,ref f,_,_,_,_) => f }
-        (n6, n6_ref) -> G { (_,_,_,_,_,_,g,_,_,_), (_,_,_,_,_,_,ref g,_,_,_) => g }
-        (n7, n7_ref) -> H { (_,_,_,_,_,_,_,h,_,_), (_,_,_,_,_,_,_,ref h,_,_) => h }
-        (n8, n8_ref) -> I { (_,_,_,_,_,_,_,_,i,_), (_,_,_,_,_,_,_,_,ref i,_) => i }
-        (n9, n9_ref) -> J { (_,_,_,_,_,_,_,_,_,j), (_,_,_,_,_,_,_,_,_,ref j) => j }
+    Tuple10 {
+        (val0, ref0, mut0) -> A { (a, b, c, d, e, f, g, h, i, j) => a }
+        (val1, ref1, mut1) -> B { (a, b, c, d, e, f, g, h, i, j) => b }
+        (val2, ref2, mut2) -> C { (a, b, c, d, e, f, g, h, i, j) => c }
+        (val3, ref3, mut3) -> D { (a, b, c, d, e, f, g, h, i, j) => d }
+        (val4, ref4, mut4) -> E { (a, b, c, d, e, f, g, h, i, j) => e }
+        (val5, ref5, mut5) -> F { (a, b, c, d, e, f, g, h, i, j) => f }
+        (val6, ref6, mut6) -> G { (a, b, c, d, e, f, g, h, i, j) => g }
+        (val7, ref7, mut7) -> H { (a, b, c, d, e, f, g, h, i, j) => h }
+        (val8, ref8, mut8) -> I { (a, b, c, d, e, f, g, h, i, j) => i }
+        (val9, ref9, mut9) -> J { (a, b, c, d, e, f, g, h, i, j) => j }
     }
-
-    (Tuple11, ImmutableTuple11) {
-        (n0,  n0_ref)  -> A { (a,_,_,_,_,_,_,_,_,_,_), (ref a,_,_,_,_,_,_,_,_,_,_) => a }
-        (n1,  n1_ref)  -> B { (_,b,_,_,_,_,_,_,_,_,_), (_,ref b,_,_,_,_,_,_,_,_,_) => b }
-        (n2,  n2_ref)  -> C { (_,_,c,_,_,_,_,_,_,_,_), (_,_,ref c,_,_,_,_,_,_,_,_) => c }
-        (n3,  n3_ref)  -> D { (_,_,_,d,_,_,_,_,_,_,_), (_,_,_,ref d,_,_,_,_,_,_,_) => d }
-        (n4,  n4_ref)  -> E { (_,_,_,_,e,_,_,_,_,_,_), (_,_,_,_,ref e,_,_,_,_,_,_) => e }
-        (n5,  n5_ref)  -> F { (_,_,_,_,_,f,_,_,_,_,_), (_,_,_,_,_,ref f,_,_,_,_,_) => f }
-        (n6,  n6_ref)  -> G { (_,_,_,_,_,_,g,_,_,_,_), (_,_,_,_,_,_,ref g,_,_,_,_) => g }
-        (n7,  n7_ref)  -> H { (_,_,_,_,_,_,_,h,_,_,_), (_,_,_,_,_,_,_,ref h,_,_,_) => h }
-        (n8,  n8_ref)  -> I { (_,_,_,_,_,_,_,_,i,_,_), (_,_,_,_,_,_,_,_,ref i,_,_) => i }
-        (n9,  n9_ref)  -> J { (_,_,_,_,_,_,_,_,_,j,_), (_,_,_,_,_,_,_,_,_,ref j,_) => j }
-        (n10, n10_ref) -> K { (_,_,_,_,_,_,_,_,_,_,k), (_,_,_,_,_,_,_,_,_,_,ref k) => k }
+    Tuple11 {
+        (val0,  ref0,  mut0)  -> A { (a, b, c, d, e, f, g, h, i, j, k) => a }
+        (val1,  ref1,  mut1)  -> B { (a, b, c, d, e, f, g, h, i, j, k) => b }
+        (val2,  ref2,  mut2)  -> C { (a, b, c, d, e, f, g, h, i, j, k) => c }
+        (val3,  ref3,  mut3)  -> D { (a, b, c, d, e, f, g, h, i, j, k) => d }
+        (val4,  ref4,  mut4)  -> E { (a, b, c, d, e, f, g, h, i, j, k) => e }
+        (val5,  ref5,  mut5)  -> F { (a, b, c, d, e, f, g, h, i, j, k) => f }
+        (val6,  ref6,  mut6)  -> G { (a, b, c, d, e, f, g, h, i, j, k) => g }
+        (val7,  ref7,  mut7)  -> H { (a, b, c, d, e, f, g, h, i, j, k) => h }
+        (val8,  ref8,  mut8)  -> I { (a, b, c, d, e, f, g, h, i, j, k) => i }
+        (val9,  ref9,  mut9)  -> J { (a, b, c, d, e, f, g, h, i, j, k) => j }
+        (val10, ref10, mut10) -> K { (a, b, c, d, e, f, g, h, i, j, k) => k }
     }
-
-    (Tuple12, ImmutableTuple12) {
-        (n0,  n0_ref)  -> A { (a,_,_,_,_,_,_,_,_,_,_,_), (ref a,_,_,_,_,_,_,_,_,_,_,_) => a }
-        (n1,  n1_ref)  -> B { (_,b,_,_,_,_,_,_,_,_,_,_), (_,ref b,_,_,_,_,_,_,_,_,_,_) => b }
-        (n2,  n2_ref)  -> C { (_,_,c,_,_,_,_,_,_,_,_,_), (_,_,ref c,_,_,_,_,_,_,_,_,_) => c }
-        (n3,  n3_ref)  -> D { (_,_,_,d,_,_,_,_,_,_,_,_), (_,_,_,ref d,_,_,_,_,_,_,_,_) => d }
-        (n4,  n4_ref)  -> E { (_,_,_,_,e,_,_,_,_,_,_,_), (_,_,_,_,ref e,_,_,_,_,_,_,_) => e }
-        (n5,  n5_ref)  -> F { (_,_,_,_,_,f,_,_,_,_,_,_), (_,_,_,_,_,ref f,_,_,_,_,_,_) => f }
-        (n6,  n6_ref)  -> G { (_,_,_,_,_,_,g,_,_,_,_,_), (_,_,_,_,_,_,ref g,_,_,_,_,_) => g }
-        (n7,  n7_ref)  -> H { (_,_,_,_,_,_,_,h,_,_,_,_), (_,_,_,_,_,_,_,ref h,_,_,_,_) => h }
-        (n8,  n8_ref)  -> I { (_,_,_,_,_,_,_,_,i,_,_,_), (_,_,_,_,_,_,_,_,ref i,_,_,_) => i }
-        (n9,  n9_ref)  -> J { (_,_,_,_,_,_,_,_,_,j,_,_), (_,_,_,_,_,_,_,_,_,ref j,_,_) => j }
-        (n10, n10_ref) -> K { (_,_,_,_,_,_,_,_,_,_,k,_), (_,_,_,_,_,_,_,_,_,_,ref k,_) => k }
-        (n11, n11_ref) -> L { (_,_,_,_,_,_,_,_,_,_,_,l), (_,_,_,_,_,_,_,_,_,_,_,ref l) => l }
+    Tuple12 {
+        (val0,  ref0,  mut0)  -> A { (a, b, c, d, e, f, g, h, i, j, k, l) => a }
+        (val1,  ref1,  mut1)  -> B { (a, b, c, d, e, f, g, h, i, j, k, l) => b }
+        (val2,  ref2,  mut2)  -> C { (a, b, c, d, e, f, g, h, i, j, k, l) => c }
+        (val3,  ref3,  mut3)  -> D { (a, b, c, d, e, f, g, h, i, j, k, l) => d }
+        (val4,  ref4,  mut4)  -> E { (a, b, c, d, e, f, g, h, i, j, k, l) => e }
+        (val5,  ref5,  mut5)  -> F { (a, b, c, d, e, f, g, h, i, j, k, l) => f }
+        (val6,  ref6,  mut6)  -> G { (a, b, c, d, e, f, g, h, i, j, k, l) => g }
+        (val7,  ref7,  mut7)  -> H { (a, b, c, d, e, f, g, h, i, j, k, l) => h }
+        (val8,  ref8,  mut8)  -> I { (a, b, c, d, e, f, g, h, i, j, k, l) => i }
+        (val9,  ref9,  mut9)  -> J { (a, b, c, d, e, f, g, h, i, j, k, l) => j }
+        (val10, ref10, mut10) -> K { (a, b, c, d, e, f, g, h, i, j, k, l) => k }
+        (val11, ref11, mut11) -> L { (a, b, c, d, e, f, g, h, i, j, k, l) => l }
     }
 }
 
@@ -326,55 +280,36 @@ mod tests {
     use cmp::*;
 
     #[test]
-    fn test_tuple_ref() {
-        let x = (~"foo", ~"bar");
-        assert_eq!(x.first_ref(), &~"foo");
-        assert_eq!(x.second_ref(), &~"bar");
-    }
-
-    #[test]
-    fn test_tuple() {
-        assert_eq!((948, 4039.48).first(), 948);
-        assert_eq!((34.5, ~"foo").second(), ~"foo");
-        assert_eq!(('a', 2).swap(), (2, 'a'));
-    }
-
-    #[test]
     fn test_clone() {
         let a = (1, ~"2");
         let b = a.clone();
-        assert_eq!(a.first(), b.first());
-        assert_eq!(a.second(), b.second());
+        assert_eq!(a, b);
     }
 
     #[test]
-    fn test_n_tuple() {
-        let t = (0u8, 1u16, 2u32, 3u64, 4u, 5i8, 6i16, 7i32, 8i64, 9i, 10f32, 11f64);
-        assert_eq!(t.n0(), 0u8);
-        assert_eq!(t.n1(), 1u16);
-        assert_eq!(t.n2(), 2u32);
-        assert_eq!(t.n3(), 3u64);
-        assert_eq!(t.n4(), 4u);
-        assert_eq!(t.n5(), 5i8);
-        assert_eq!(t.n6(), 6i16);
-        assert_eq!(t.n7(), 7i32);
-        assert_eq!(t.n8(), 8i64);
-        assert_eq!(t.n9(), 9i);
-        assert_eq!(t.n10(), 10f32);
-        assert_eq!(t.n11(), 11f64);
-
-        assert_eq!(t.n0_ref(), &0u8);
-        assert_eq!(t.n1_ref(), &1u16);
-        assert_eq!(t.n2_ref(), &2u32);
-        assert_eq!(t.n3_ref(), &3u64);
-        assert_eq!(t.n4_ref(), &4u);
-        assert_eq!(t.n5_ref(), &5i8);
-        assert_eq!(t.n6_ref(), &6i16);
-        assert_eq!(t.n7_ref(), &7i32);
-        assert_eq!(t.n8_ref(), &8i64);
-        assert_eq!(t.n9_ref(), &9i);
-        assert_eq!(t.n10_ref(), &10f32);
-        assert_eq!(t.n11_ref(), &11f64);
+    fn test_getters() {
+        macro_rules! test_getter(
+            ($x:expr, $valN:ident, $refN:ident, $mutN:ident,
+             $init:expr, $incr:expr, $result:expr) => ({
+                assert_eq!($x.$valN(), $init);
+                assert_eq!(*$x.$refN(), $init);
+                *$x.$mutN() += $incr;
+                assert_eq!(*$x.$refN(), $result);
+            })
+        )
+        let mut x = (0u8, 1u16, 2u32, 3u64, 4u, 5i8, 6i16, 7i32, 8i64, 9i, 10f32, 11f64);
+        test_getter!(x, val0,  ref0,  mut0,  0,    1,   1);
+        test_getter!(x, val1,  ref1,  mut1,  1,    1,   2);
+        test_getter!(x, val2,  ref2,  mut2,  2,    1,   3);
+        test_getter!(x, val3,  ref3,  mut3,  3,    1,   4);
+        test_getter!(x, val4,  ref4,  mut4,  4,    1,   5);
+        test_getter!(x, val5,  ref5,  mut5,  5,    1,   6);
+        test_getter!(x, val6,  ref6,  mut6,  6,    1,   7);
+        test_getter!(x, val7,  ref7,  mut7,  7,    1,   8);
+        test_getter!(x, val8,  ref8,  mut8,  8,    1,   9);
+        test_getter!(x, val9,  ref9,  mut9,  9,    1,   10);
+        test_getter!(x, val10, ref10, mut10, 10.0, 1.0, 11.0);
+        test_getter!(x, val11, ref11, mut11, 11.0, 1.0, 12.0);
     }
 
     #[test]
@@ -422,4 +357,11 @@ mod tests {
         assert_eq!(small.cmp(&big), Less);
         assert_eq!(big.cmp(&small), Greater);
     }
+
+    #[test]
+    fn test_show() {
+        assert_eq!(format!("{}", (1,)), ~"(1,)");
+        assert_eq!(format!("{}", (1, true)), ~"(1, true)");
+        assert_eq!(format!("{}", (1, ~"hi", true)), ~"(1, hi, true)");
+    }
 }
diff --git a/src/test/bench/shootout-fasta.rs b/src/test/bench/shootout-fasta.rs
index 12e78629386..f0c3517a0b8 100644
--- a/src/test/bench/shootout-fasta.rs
+++ b/src/test/bench/shootout-fasta.rs
@@ -51,7 +51,7 @@ impl<'a> Iterator<u8> for AAGen<'a> {
     fn next(&mut self) -> Option<u8> {
         let r = self.rng.gen();
         self.data.iter()
-            .skip_while(|pc| pc.n0() < r)
+            .skip_while(|pc| pc.val0() < r)
             .map(|&(_, c)| c)
             .next()
     }
diff --git a/src/test/bench/task-perf-alloc-unwind.rs b/src/test/bench/task-perf-alloc-unwind.rs
index 013df3b3675..51eb65b1d5c 100644
--- a/src/test/bench/task-perf-alloc-unwind.rs
+++ b/src/test/bench/task-perf-alloc-unwind.rs
@@ -90,8 +90,8 @@ fn recurse_or_fail(depth: int, st: Option<State>) {
             State {
                 managed: @Cons((), st.managed),
                 unique: ~Cons((), @*st.unique),
-                tuple: (@Cons((), st.tuple.first()),
-                        ~Cons((), @*st.tuple.second())),
+                tuple: (@Cons((), st.tuple.ref0().clone()),
+                        ~Cons((), @*st.tuple.ref1().clone())),
                 vec: st.vec + &[@Cons((), *st.vec.last().unwrap())],
                 res: r(@Cons((), st.res._l))
             }