about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-11-29 14:01:48 -0800
committerbors <bors@rust-lang.org>2013-11-29 14:01:48 -0800
commit80991bb578329ca921fdc910d9b6b064e8f521d2 (patch)
treeaa303d7064dc72da11ace2e5782078be1136e9c1 /src/libstd
parentdd1184eedb0e0828cea2f18d3fbd6319e981afda (diff)
parent4840064f85a28c9332d928ad0631e9dc2d21e150 (diff)
downloadrust-80991bb578329ca921fdc910d9b6b064e8f521d2.tar.gz
rust-80991bb578329ca921fdc910d9b6b064e8f521d2.zip
auto merge of #10719 : Kimundi/rust/switch_to_multi_item_macros, r=alexcrichton
- Removed module reexport workaround for the integer module macros
- Removed legacy reexports of `cmp::{min, max}` in the integer module macros
- Combined a few macros in `vec` into one
- Documented a few issues

Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/fmt/mod.rs41
-rw-r--r--src/libstd/num/f32.rs33
-rw-r--r--src/libstd/num/f64.rs33
-rw-r--r--src/libstd/num/i16.rs10
-rw-r--r--src/libstd/num/i32.rs10
-rw-r--r--src/libstd/num/i64.rs12
-rw-r--r--src/libstd/num/i8.rs10
-rw-r--r--src/libstd/num/int.rs14
-rw-r--r--src/libstd/num/int_macros.rs16
-rw-r--r--src/libstd/num/u16.rs11
-rw-r--r--src/libstd/num/u32.rs11
-rw-r--r--src/libstd/num/u64.rs13
-rw-r--r--src/libstd/num/u8.rs11
-rw-r--r--src/libstd/num/uint.rs15
-rw-r--r--src/libstd/num/uint_macros.rs17
-rw-r--r--src/libstd/rt/logging.rs3
-rw-r--r--src/libstd/tuple.rs184
-rw-r--r--src/libstd/vec.rs31
18 files changed, 232 insertions, 243 deletions
diff --git a/src/libstd/fmt/mod.rs b/src/libstd/fmt/mod.rs
index 9fa2c7ab1f3..c74a9bc9051 100644
--- a/src/libstd/fmt/mod.rs
+++ b/src/libstd/fmt/mod.rs
@@ -901,7 +901,7 @@ impl<'self> Formatter<'self> {
                 // case where the maximum length will matter.
                 let char_len = s.char_len();
                 if char_len >= max {
-                    let nchars = ::uint::min(max, char_len);
+                    let nchars = ::cmp::min(max, char_len);
                     self.buf.write(s.slice_chars(0, nchars).as_bytes());
                     return
                 }
@@ -1036,31 +1036,26 @@ pub fn upperhex(buf: &[u8], f: &mut Formatter) {
     f.pad_integral(local.slice_to(buf.len()), "0x", true);
 }
 
-// FIXME(#4375) shouldn't need an inner module
 macro_rules! integer(($signed:ident, $unsigned:ident) => {
-    mod $signed {
-        use super::*;
-
-        // Signed is special because it actuall emits the negative sign,
-        // nothing else should do that, however.
-        impl Signed for $signed {
-            fn fmt(c: &$signed, f: &mut Formatter) {
-                ::$unsigned::to_str_bytes(c.abs() as $unsigned, 10, |buf| {
-                    f.pad_integral(buf, "", *c >= 0);
-                })
-            }
+    // Signed is special because it actuall emits the negative sign,
+    // nothing else should do that, however.
+    impl Signed for $signed {
+        fn fmt(c: &$signed, f: &mut Formatter) {
+            ::$unsigned::to_str_bytes(c.abs() as $unsigned, 10, |buf| {
+                f.pad_integral(buf, "", *c >= 0);
+            })
         }
-        int_base!($signed, $unsigned, 2, Binary, "0b")
-        int_base!($signed, $unsigned, 8, Octal, "0o")
-        int_base!($signed, $unsigned, 16, LowerHex, "0x")
-        upper_hex!($signed, $unsigned)
-
-        int_base!($unsigned, $unsigned, 2, Binary, "0b")
-        int_base!($unsigned, $unsigned, 8, Octal, "0o")
-        int_base!($unsigned, $unsigned, 10, Unsigned, "")
-        int_base!($unsigned, $unsigned, 16, LowerHex, "0x")
-        upper_hex!($unsigned, $unsigned)
     }
+    int_base!($signed, $unsigned, 2, Binary, "0b")
+    int_base!($signed, $unsigned, 8, Octal, "0o")
+    int_base!($signed, $unsigned, 16, LowerHex, "0x")
+    upper_hex!($signed, $unsigned)
+
+    int_base!($unsigned, $unsigned, 2, Binary, "0b")
+    int_base!($unsigned, $unsigned, 8, Octal, "0o")
+    int_base!($unsigned, $unsigned, 10, Unsigned, "")
+    int_base!($unsigned, $unsigned, 16, LowerHex, "0x")
+    upper_hex!($unsigned, $unsigned)
 })
 
 integer!(int, uint)
diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs
index a0dddffd851..53bd2d3dc08 100644
--- a/src/libstd/num/f32.rs
+++ b/src/libstd/num/f32.rs
@@ -11,18 +11,19 @@
 //! Operations and constants for `f32`
 #[allow(missing_doc)];
 
+use prelude::*;
+
+use cmath::c_float_utils;
 use default::Default;
-use libc::c_int;
-use num::{Zero, One, strconv};
+use libc::{c_float, c_int};
 use num::{FPCategory, FPNaN, FPInfinite , FPZero, FPSubnormal, FPNormal};
+use num::{Zero, One, strconv};
 use num;
-use prelude::*;
 use to_str;
+use unstable::intrinsics;
 
 pub use cmath::c_float_targ_consts::*;
 
-use self::delegated::*;
-
 macro_rules! delegate(
     (
         $(
@@ -33,22 +34,14 @@ macro_rules! delegate(
             ) -> $rv:ty = $bound_name:path
         ),*
     ) => (
-        // An inner module is required to get the #[inline] attribute on the
-        // functions.
-        mod delegated {
-            use cmath::c_float_utils;
-            use libc::{c_float, c_int};
-            use unstable::intrinsics;
-
-            $(
-                #[inline]
-                pub fn $name($( $arg : $arg_ty ),*) -> $rv {
-                    unsafe {
-                        $bound_name($( $arg ),*)
-                    }
+        $(
+            #[inline]
+            pub fn $name($( $arg : $arg_ty ),*) -> $rv {
+                unsafe {
+                    $bound_name($( $arg ),*)
                 }
-            )*
-        }
+            }
+        )*
     )
 )
 
diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs
index 8cb7fa18001..49b20b2c4f4 100644
--- a/src/libstd/num/f64.rs
+++ b/src/libstd/num/f64.rs
@@ -12,19 +12,20 @@
 
 #[allow(missing_doc)];
 
+use prelude::*;
+
+use cmath::c_double_utils;
 use default::Default;
-use libc::c_int;
-use num::{Zero, One, strconv};
+use libc::{c_double, c_int};
 use num::{FPCategory, FPNaN, FPInfinite , FPZero, FPSubnormal, FPNormal};
+use num::{Zero, One, strconv};
 use num;
-use prelude::*;
 use to_str;
+use unstable::intrinsics;
 
 pub use cmath::c_double_targ_consts::*;
 pub use cmp::{min, max};
 
-use self::delegated::*;
-
 macro_rules! delegate(
     (
         $(
@@ -35,22 +36,14 @@ macro_rules! delegate(
             ) -> $rv:ty = $bound_name:path
         ),*
     ) => (
-        // An inner module is required to get the #[inline] attribute on the
-        // functions.
-        mod delegated {
-            use cmath::c_double_utils;
-            use libc::{c_double, c_int};
-            use unstable::intrinsics;
-
-            $(
-                #[inline]
-                pub fn $name($( $arg : $arg_ty ),*) -> $rv {
-                    unsafe {
-                        $bound_name($( $arg ),*)
-                    }
+        $(
+            #[inline]
+            pub fn $name($( $arg : $arg_ty ),*) -> $rv {
+                unsafe {
+                    $bound_name($( $arg ),*)
                 }
-            )*
-        }
+            }
+        )*
     )
 )
 
diff --git a/src/libstd/num/i16.rs b/src/libstd/num/i16.rs
index 5c077c7e633..fcf1f24d0e4 100644
--- a/src/libstd/num/i16.rs
+++ b/src/libstd/num/i16.rs
@@ -10,12 +10,18 @@
 
 //! Operations and constants for `i16`
 
+#[allow(non_uppercase_statics)];
+
+use prelude::*;
+
+use default::Default;
 use num::{BitCount, CheckedAdd, CheckedSub, CheckedMul};
+use num::{CheckedDiv, Zero, One, strconv};
+use num::{ToStrRadix, FromStrRadix};
 use option::{Option, Some, None};
+use str;
 use unstable::intrinsics;
 
-pub use self::generated::*;
-
 int_module!(i16, 16)
 
 impl BitCount for i16 {
diff --git a/src/libstd/num/i32.rs b/src/libstd/num/i32.rs
index f076e33b3a2..385e1c91ca5 100644
--- a/src/libstd/num/i32.rs
+++ b/src/libstd/num/i32.rs
@@ -10,12 +10,18 @@
 
 //! Operations and constants for `i32`
 
+#[allow(non_uppercase_statics)];
+
+use prelude::*;
+
+use default::Default;
 use num::{BitCount, CheckedAdd, CheckedSub, CheckedMul};
+use num::{CheckedDiv, Zero, One, strconv};
+use num::{ToStrRadix, FromStrRadix};
 use option::{Option, Some, None};
+use str;
 use unstable::intrinsics;
 
-pub use self::generated::*;
-
 int_module!(i32, 32)
 
 impl BitCount for i32 {
diff --git a/src/libstd/num/i64.rs b/src/libstd/num/i64.rs
index d991bf03300..f6b369b1312 100644
--- a/src/libstd/num/i64.rs
+++ b/src/libstd/num/i64.rs
@@ -10,14 +10,20 @@
 
 //! Operations and constants for `i64`
 
-use num::{BitCount, CheckedAdd, CheckedSub};
+#[allow(non_uppercase_statics)];
+
+use prelude::*;
+
+use default::Default;
 #[cfg(target_word_size = "64")]
 use num::CheckedMul;
+use num::{BitCount, CheckedAdd, CheckedSub};
+use num::{CheckedDiv, Zero, One, strconv};
+use num::{ToStrRadix, FromStrRadix};
 use option::{Option, Some, None};
+use str;
 use unstable::intrinsics;
 
-pub use self::generated::*;
-
 int_module!(i64, 64)
 
 impl BitCount for i64 {
diff --git a/src/libstd/num/i8.rs b/src/libstd/num/i8.rs
index a807f6b9e53..9de90ca4657 100644
--- a/src/libstd/num/i8.rs
+++ b/src/libstd/num/i8.rs
@@ -10,12 +10,18 @@
 
 //! Operations and constants for `i8`
 
+#[allow(non_uppercase_statics)];
+
+use prelude::*;
+
+use default::Default;
 use num::{BitCount, CheckedAdd, CheckedSub, CheckedMul};
+use num::{CheckedDiv, Zero, One, strconv};
+use num::{ToStrRadix, FromStrRadix};
 use option::{Option, Some, None};
+use str;
 use unstable::intrinsics;
 
-pub use self::generated::*;
-
 int_module!(i8, 8)
 
 impl BitCount for i8 {
diff --git a/src/libstd/num/int.rs b/src/libstd/num/int.rs
index c5364fa3dab..517bd45e45b 100644
--- a/src/libstd/num/int.rs
+++ b/src/libstd/num/int.rs
@@ -12,16 +12,18 @@
 
 #[allow(non_uppercase_statics)];
 
+use prelude::*;
+
+use default::Default;
 use num::{BitCount, CheckedAdd, CheckedSub, CheckedMul};
+use num::{CheckedDiv, Zero, One, strconv};
+use num::{ToStrRadix, FromStrRadix};
 use option::{Option, Some, None};
+use str;
 use unstable::intrinsics;
 
-pub use self::generated::*;
-
-#[cfg(target_word_size = "32")] pub static bits: uint = 32;
-#[cfg(target_word_size = "64")] pub static bits: uint = 64;
-
-int_module!(int, super::bits)
+#[cfg(target_word_size = "32")] int_module!(int, 32)
+#[cfg(target_word_size = "64")] int_module!(int, 64)
 
 #[cfg(target_word_size = "32")]
 impl BitCount for int {
diff --git a/src/libstd/num/int_macros.rs b/src/libstd/num/int_macros.rs
index fc56bf91c2a..8c60b0ec75a 100644
--- a/src/libstd/num/int_macros.rs
+++ b/src/libstd/num/int_macros.rs
@@ -8,22 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// FIXME(#4375): this shouldn't have to be a nested module named 'generated'
-
 #[macro_escape];
 #[doc(hidden)];
 
-macro_rules! int_module (($T:ty, $bits:expr) => (mod generated {
-
-#[allow(non_uppercase_statics)];
-
-use default::Default;
-use num::{ToStrRadix, FromStrRadix};
-use num::{CheckedDiv, Zero, One, strconv};
-use prelude::*;
-use str;
-
-pub use cmp::{min, max};
+macro_rules! int_module (($T:ty, $bits:expr) => (
 
 pub static bits : uint = $bits;
 pub static bytes : uint = ($bits / 8);
@@ -781,4 +769,4 @@ mod tests {
     }
 }
 
-}))
+))
diff --git a/src/libstd/num/u16.rs b/src/libstd/num/u16.rs
index e227947ca6e..ed8ec3b6c54 100644
--- a/src/libstd/num/u16.rs
+++ b/src/libstd/num/u16.rs
@@ -10,12 +10,19 @@
 
 //! Operations and constants for `u16`
 
+#[allow(non_uppercase_statics)];
+
+use prelude::*;
+
+use default::Default;
+use num::BitCount;
 use num::{CheckedAdd, CheckedSub, CheckedMul};
+use num::{CheckedDiv, Zero, One, strconv};
+use num::{ToStrRadix, FromStrRadix};
 use option::{Option, Some, None};
+use str;
 use unstable::intrinsics;
 
-pub use self::generated::*;
-
 uint_module!(u16, i16, 16)
 
 impl CheckedAdd for u16 {
diff --git a/src/libstd/num/u32.rs b/src/libstd/num/u32.rs
index 4dbd543da7b..29775498033 100644
--- a/src/libstd/num/u32.rs
+++ b/src/libstd/num/u32.rs
@@ -10,12 +10,19 @@
 
 //! Operations and constants for `u32`
 
+#[allow(non_uppercase_statics)];
+
+use prelude::*;
+
+use default::Default;
+use num::BitCount;
 use num::{CheckedAdd, CheckedSub, CheckedMul};
+use num::{CheckedDiv, Zero, One, strconv};
+use num::{ToStrRadix, FromStrRadix};
 use option::{Option, Some, None};
+use str;
 use unstable::intrinsics;
 
-pub use self::generated::*;
-
 uint_module!(u32, i32, 32)
 
 impl CheckedAdd for u32 {
diff --git a/src/libstd/num/u64.rs b/src/libstd/num/u64.rs
index d3077333077..dc43801eb39 100644
--- a/src/libstd/num/u64.rs
+++ b/src/libstd/num/u64.rs
@@ -10,14 +10,21 @@
 
 //! Operations and constants for `u64`
 
-use num::{CheckedAdd, CheckedSub};
+#[allow(non_uppercase_statics)];
+
+use prelude::*;
+
+use default::Default;
+use num::BitCount;
 #[cfg(target_word_size = "64")]
 use num::CheckedMul;
+use num::{CheckedAdd, CheckedSub};
+use num::{CheckedDiv, Zero, One, strconv};
+use num::{ToStrRadix, FromStrRadix};
 use option::{Option, Some, None};
+use str;
 use unstable::intrinsics;
 
-pub use self::generated::*;
-
 uint_module!(u64, i64, 64)
 
 impl CheckedAdd for u64 {
diff --git a/src/libstd/num/u8.rs b/src/libstd/num/u8.rs
index ca54af5cecc..12ad4efdbd5 100644
--- a/src/libstd/num/u8.rs
+++ b/src/libstd/num/u8.rs
@@ -10,12 +10,19 @@
 
 //! Operations and constants for `u8`
 
+#[allow(non_uppercase_statics)];
+
+use prelude::*;
+
+use default::Default;
+use num::BitCount;
 use num::{CheckedAdd, CheckedSub, CheckedMul};
+use num::{CheckedDiv, Zero, One, strconv};
+use num::{ToStrRadix, FromStrRadix};
 use option::{Option, Some, None};
+use str;
 use unstable::intrinsics;
 
-pub use self::generated::*;
-
 uint_module!(u8, i8, 8)
 
 impl CheckedAdd for u8 {
diff --git a/src/libstd/num/uint.rs b/src/libstd/num/uint.rs
index cf28083bb09..549490050c5 100644
--- a/src/libstd/num/uint.rs
+++ b/src/libstd/num/uint.rs
@@ -10,13 +10,20 @@
 
 //! Operations and constants for `uint`
 
-use num;
+#[allow(non_uppercase_statics)];
+
+use prelude::*;
+
+use default::Default;
+use mem;
+use num::BitCount;
 use num::{CheckedAdd, CheckedSub, CheckedMul};
+use num::{CheckedDiv, Zero, One, strconv};
+use num::{ToStrRadix, FromStrRadix};
+use num;
 use option::{Option, Some, None};
+use str;
 use unstable::intrinsics;
-use mem;
-
-pub use self::generated::*;
 
 uint_module!(uint, int, ::int::bits)
 
diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs
index 3c276378df8..ee3cd644608 100644
--- a/src/libstd/num/uint_macros.rs
+++ b/src/libstd/num/uint_macros.rs
@@ -8,23 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// FIXME(#4375): this shouldn't have to be a nested module named 'generated'
-
 #[macro_escape];
 #[doc(hidden)];
 
-macro_rules! uint_module (($T:ty, $T_SIGNED:ty, $bits:expr) => (mod generated {
-
-#[allow(non_uppercase_statics)];
-
-use default::Default;
-use num::BitCount;
-use num::{ToStrRadix, FromStrRadix};
-use num::{CheckedDiv, Zero, One, strconv};
-use prelude::*;
-use str;
-
-pub use cmp::{min, max};
+macro_rules! uint_module (($T:ty, $T_SIGNED:ty, $bits:expr) => (
 
 pub static bits : uint = $bits;
 pub static bytes : uint = ($bits / 8);
@@ -554,4 +541,4 @@ mod tests {
     }
 }
 
-}))
+))
diff --git a/src/libstd/rt/logging.rs b/src/libstd/rt/logging.rs
index 13e18f7d9b7..3f169b511df 100644
--- a/src/libstd/rt/logging.rs
+++ b/src/libstd/rt/logging.rs
@@ -17,7 +17,6 @@ use io::stdio::StdWriter;
 use io::buffered::LineBufferedWriter;
 use rt::crate_map::{ModEntry, CrateMap, iter_crate_map, get_crate_map};
 use str::StrSlice;
-use u32;
 use vec::ImmutableVector;
 #[cfg(test)] use cast::transmute;
 
@@ -46,7 +45,7 @@ fn parse_log_level(level: &str) -> Option<u32> {
             let position = log_level_names.iter().position(|&name| name == level);
             match position {
                 Some(position) => {
-                    log_level = Some(u32::min(MAX_LOG_LEVEL, (position + 1) as u32))
+                    log_level = Some(::cmp::min(MAX_LOG_LEVEL, (position + 1) as u32))
                 },
                 _ => {
                     log_level = None;
diff --git a/src/libstd/tuple.rs b/src/libstd/tuple.rs
index 623909b7975..313fd9c79b4 100644
--- a/src/libstd/tuple.rs
+++ b/src/libstd/tuple.rs
@@ -13,8 +13,9 @@
 #[allow(missing_doc)];
 
 use clone::Clone;
-
-pub use self::inner::*;
+#[cfg(not(test))] use cmp::*;
+#[cfg(not(test))] use default::Default;
+#[cfg(not(test))] use num::Zero;
 
 /// Method extensions to pairs where both types satisfy the `Clone` bound
 pub trait CopyableTuple<T, U> {
@@ -86,116 +87,109 @@ macro_rules! tuple_impls {
             })+
         }
     )+) => {
-        pub mod inner {
-            use clone::Clone;
-            #[cfg(not(test))] use cmp::*;
-            #[cfg(not(test))] use default::Default;
-            #[cfg(not(test))] use num::Zero;
-
-            $(
-                pub trait $move_trait<$($T),+> {
-                    $(fn $get_fn(self) -> $T;)+
-                }
+        $(
+            pub trait $move_trait<$($T),+> {
+                $(fn $get_fn(self) -> $T;)+
+            }
 
-                impl<$($T),+> $move_trait<$($T),+> for ($($T,)+) {
-                    $(
-                        #[inline]
-                        fn $get_fn(self) -> $T {
-                            let $move_pattern = self;
-                            $ret
-                        }
-                    )+
-                }
-
-                pub trait $immutable_trait<$($T),+> {
-                    $(fn $get_ref_fn<'a>(&'a self) -> &'a $T;)+
-                }
+            impl<$($T),+> $move_trait<$($T),+> for ($($T,)+) {
+                $(
+                    #[inline]
+                    fn $get_fn(self) -> $T {
+                        let $move_pattern = self;
+                        $ret
+                    }
+                )+
+            }
 
-                impl<$($T),+> $immutable_trait<$($T),+> for ($($T,)+) {
-                    $(
-                        #[inline]
-                        fn $get_ref_fn<'a>(&'a self) -> &'a $T {
-                            let $ref_pattern = *self;
-                            $ret
-                        }
-                    )+
-                }
+            pub trait $immutable_trait<$($T),+> {
+                $(fn $get_ref_fn<'a>(&'a self) -> &'a $T;)+
+            }
 
-                impl<$($T:Clone),+> Clone for ($($T,)+) {
-                    fn clone(&self) -> ($($T,)+) {
-                        ($(self.$get_ref_fn().clone(),)+)
+            impl<$($T),+> $immutable_trait<$($T),+> for ($($T,)+) {
+                $(
+                    #[inline]
+                    fn $get_ref_fn<'a>(&'a self) -> &'a $T {
+                        let $ref_pattern = *self;
+                        $ret
                     }
+                )+
+            }
+
+            impl<$($T:Clone),+> Clone for ($($T,)+) {
+                fn clone(&self) -> ($($T,)+) {
+                    ($(self.$get_ref_fn().clone(),)+)
                 }
+            }
 
-                #[cfg(not(test))]
-                impl<$($T:Eq),+> Eq for ($($T,)+) {
-                    #[inline]
-                    fn eq(&self, other: &($($T,)+)) -> bool {
-                        $(*self.$get_ref_fn() == *other.$get_ref_fn())&&+
-                    }
-                    #[inline]
-                    fn ne(&self, other: &($($T,)+)) -> bool {
-                        $(*self.$get_ref_fn() != *other.$get_ref_fn())||+
-                    }
+            #[cfg(not(test))]
+            impl<$($T:Eq),+> Eq for ($($T,)+) {
+                #[inline]
+                fn eq(&self, other: &($($T,)+)) -> bool {
+                    $(*self.$get_ref_fn() == *other.$get_ref_fn())&&+
+                }
+                #[inline]
+                fn ne(&self, other: &($($T,)+)) -> bool {
+                    $(*self.$get_ref_fn() != *other.$get_ref_fn())||+
                 }
+            }
 
-                #[cfg(not(test))]
-                impl<$($T:TotalEq),+> TotalEq for ($($T,)+) {
-                    #[inline]
-                    fn equals(&self, other: &($($T,)+)) -> bool {
-                        $(self.$get_ref_fn().equals(other.$get_ref_fn()))&&+
-                    }
+            #[cfg(not(test))]
+            impl<$($T:TotalEq),+> TotalEq for ($($T,)+) {
+                #[inline]
+                fn equals(&self, other: &($($T,)+)) -> bool {
+                    $(self.$get_ref_fn().equals(other.$get_ref_fn()))&&+
                 }
+            }
 
-                #[cfg(not(test))]
-                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()),+)
-                    }
-                    #[inline]
-                    fn le(&self, other: &($($T,)+)) -> bool {
-                        lexical_ord!(le, $(self.$get_ref_fn(), other.$get_ref_fn()),+)
-                    }
-                    #[inline]
-                    fn ge(&self, other: &($($T,)+)) -> bool {
-                        lexical_ord!(ge, $(self.$get_ref_fn(), other.$get_ref_fn()),+)
-                    }
-                    #[inline]
-                    fn gt(&self, other: &($($T,)+)) -> bool {
-                        lexical_ord!(gt, $(self.$get_ref_fn(), other.$get_ref_fn()),+)
-                    }
+            #[cfg(not(test))]
+            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()),+)
+                }
+                #[inline]
+                fn le(&self, other: &($($T,)+)) -> bool {
+                    lexical_ord!(le, $(self.$get_ref_fn(), other.$get_ref_fn()),+)
+                }
+                #[inline]
+                fn ge(&self, other: &($($T,)+)) -> bool {
+                    lexical_ord!(ge, $(self.$get_ref_fn(), other.$get_ref_fn()),+)
                 }
+                #[inline]
+                fn gt(&self, other: &($($T,)+)) -> bool {
+                    lexical_ord!(gt, $(self.$get_ref_fn(), other.$get_ref_fn()),+)
+                }
+            }
 
-                #[cfg(not(test))]
-                impl<$($T:TotalOrd),+> TotalOrd for ($($T,)+) {
-                    #[inline]
-                    fn cmp(&self, other: &($($T,)+)) -> Ordering {
-                        lexical_cmp!($(self.$get_ref_fn(), other.$get_ref_fn()),+)
-                    }
+            #[cfg(not(test))]
+            impl<$($T:TotalOrd),+> TotalOrd for ($($T,)+) {
+                #[inline]
+                fn cmp(&self, other: &($($T,)+)) -> Ordering {
+                    lexical_cmp!($(self.$get_ref_fn(), other.$get_ref_fn()),+)
                 }
+            }
 
-                #[cfg(not(test))]
-                impl<$($T:Default),+> Default for ($($T,)+) {
-                    #[inline]
-                    fn default() -> ($($T,)+) {
-                        ($({ let x: $T = Default::default(); x},)+)
-                    }
+            #[cfg(not(test))]
+            impl<$($T:Default),+> Default for ($($T,)+) {
+                #[inline]
+                fn default() -> ($($T,)+) {
+                    ($({ let x: $T = Default::default(); x},)+)
                 }
+            }
 
-                #[cfg(not(test))]
-                impl<$($T:Zero),+> Zero for ($($T,)+) {
-                    #[inline]
-                    fn zero() -> ($($T,)+) {
-                        ($({ let x: $T = Zero::zero(); x},)+)
-                    }
-                    #[inline]
-                    fn is_zero(&self) -> bool {
-                        $(self.$get_ref_fn().is_zero())&&+
-                    }
+            #[cfg(not(test))]
+            impl<$($T:Zero),+> Zero for ($($T,)+) {
+                #[inline]
+                fn zero() -> ($($T,)+) {
+                    ($({ let x: $T = Zero::zero(); x},)+)
                 }
-            )+
-        }
+                #[inline]
+                fn is_zero(&self) -> bool {
+                    $(self.$get_ref_fn().is_zero())&&+
+                }
+            }
+        )+
     }
 }
 
diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs
index e76251e8a1e..293c9ed9817 100644
--- a/src/libstd/vec.rs
+++ b/src/libstd/vec.rs
@@ -2463,15 +2463,14 @@ impl<A> Default for @[A] {
 }
 
 macro_rules! iterator {
-    /* FIXME: #4375 Cannot attach documentation/attributes to a macro generated struct.
     (struct $name:ident -> $ptr:ty, $elem:ty) => {
+        /// An iterator for iterating over a vector.
         pub struct $name<'self, T> {
             priv ptr: $ptr,
             priv end: $ptr,
-            priv lifetime: $elem // FIXME: #5922
+            priv lifetime: Option<$elem> // FIXME: #5922
         }
-    };*/
-    (impl $name:ident -> $elem:ty) => {
+
         impl<'self, T> Iterator<$elem> for $name<'self, T> {
             #[inline]
             fn next(&mut self) -> Option<$elem> {
@@ -2502,11 +2501,7 @@ macro_rules! iterator {
                 (exact, Some(exact))
             }
         }
-    }
-}
 
-macro_rules! double_ended_iterator {
-    (impl $name:ident -> $elem:ty) => {
         impl<'self, T> DoubleEndedIterator<$elem> for $name<'self, T> {
             #[inline]
             fn next_back(&mut self) -> Option<$elem> {
@@ -2548,15 +2543,7 @@ impl<'self, T> RandomAccessIterator<&'self T> for VecIterator<'self, T> {
     }
 }
 
-//iterator!{struct VecIterator -> *T, &'self T}
-/// An iterator for iterating over a vector.
-pub struct VecIterator<'self, T> {
-    priv ptr: *T,
-    priv end: *T,
-    priv lifetime: Option<&'self ()> // FIXME: #5922
-}
-iterator!{impl VecIterator -> &'self T}
-double_ended_iterator!{impl VecIterator -> &'self T}
+iterator!{struct VecIterator -> *T, &'self T}
 pub type RevIterator<'self, T> = Invert<VecIterator<'self, T>>;
 
 impl<'self, T> ExactSize<&'self T> for VecIterator<'self, T> {}
@@ -2566,15 +2553,7 @@ impl<'self, T> Clone for VecIterator<'self, T> {
     fn clone(&self) -> VecIterator<'self, T> { *self }
 }
 
-//iterator!{struct VecMutIterator -> *mut T, &'self mut T}
-/// An iterator for mutating the elements of a vector.
-pub struct VecMutIterator<'self, T> {
-    priv ptr: *mut T,
-    priv end: *mut T,
-    priv lifetime: Option<&'self mut ()> // FIXME: #5922
-}
-iterator!{impl VecMutIterator -> &'self mut T}
-double_ended_iterator!{impl VecMutIterator -> &'self mut T}
+iterator!{struct VecMutIterator -> *mut T, &'self mut T}
 pub type MutRevIterator<'self, T> = Invert<VecMutIterator<'self, T>>;
 
 /// An iterator that moves out of a vector.