about summary refs log tree commit diff
path: root/src/libcore/num
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-11-14 09:18:10 -0800
committerJorge Aparicio <japaricious@gmail.com>2014-12-18 12:09:07 -0500
commitddb2466f6a1bb66f22824334022a4cee61c73bdc (patch)
tree9cb97d3e4c4521b56d0776e5f7bda81e62135be4 /src/libcore/num
parentc0b2885ee12b79c99ac8245edb6eebaaa8e7fef1 (diff)
downloadrust-ddb2466f6a1bb66f22824334022a4cee61c73bdc.tar.gz
rust-ddb2466f6a1bb66f22824334022a4cee61c73bdc.zip
librustc: Always parse `macro!()`/`macro![]` as expressions if not
followed by a semicolon.

This allows code like `vec![1i, 2, 3].len();` to work.

This breaks code that uses macros as statements without putting
semicolons after them, such as:

    fn main() {
        ...
        assert!(a == b)
        assert!(c == d)
        println(...);
    }

It also breaks code that uses macros as items without semicolons:

    local_data_key!(foo)

    fn main() {
        println("hello world")
    }

Add semicolons to fix this code. Those two examples can be fixed as
follows:

    fn main() {
        ...
        assert!(a == b);
        assert!(c == d);
        println(...);
    }

    local_data_key!(foo);

    fn main() {
        println("hello world")
    }

RFC #378.

Closes #18635.

[breaking-change]
Diffstat (limited to 'src/libcore/num')
-rw-r--r--src/libcore/num/float_macros.rs5
-rw-r--r--src/libcore/num/i16.rs2
-rw-r--r--src/libcore/num/i32.rs2
-rw-r--r--src/libcore/num/i64.rs2
-rw-r--r--src/libcore/num/i8.rs2
-rw-r--r--src/libcore/num/int.rs4
-rw-r--r--src/libcore/num/int_macros.rs5
-rw-r--r--src/libcore/num/mod.rs276
-rw-r--r--src/libcore/num/u16.rs2
-rw-r--r--src/libcore/num/u32.rs2
-rw-r--r--src/libcore/num/u64.rs2
-rw-r--r--src/libcore/num/u8.rs2
-rw-r--r--src/libcore/num/uint.rs2
-rw-r--r--src/libcore/num/uint_macros.rs5
14 files changed, 158 insertions, 155 deletions
diff --git a/src/libcore/num/float_macros.rs b/src/libcore/num/float_macros.rs
index d15cff3a8a9..97de61d7e27 100644
--- a/src/libcore/num/float_macros.rs
+++ b/src/libcore/num/float_macros.rs
@@ -11,11 +11,12 @@
 #![macro_escape]
 #![doc(hidden)]
 
-macro_rules! assert_approx_eq(
+macro_rules! assert_approx_eq {
     ($a:expr, $b:expr) => ({
         use num::Float;
         let (a, b) = (&$a, &$b);
         assert!((*a - *b).abs() < 1.0e-6,
                 "{} is not approximately equal to {}", *a, *b);
     })
-)
+}
+
diff --git a/src/libcore/num/i16.rs b/src/libcore/num/i16.rs
index 00c8dc5b68d..eb2a4c3835d 100644
--- a/src/libcore/num/i16.rs
+++ b/src/libcore/num/i16.rs
@@ -13,4 +13,4 @@
 #![stable]
 #![doc(primitive = "i16")]
 
-int_module!(i16, 16)
+int_module! { i16, 16 }
diff --git a/src/libcore/num/i32.rs b/src/libcore/num/i32.rs
index 1879ce1ac86..849fa205756 100644
--- a/src/libcore/num/i32.rs
+++ b/src/libcore/num/i32.rs
@@ -13,4 +13,4 @@
 #![stable]
 #![doc(primitive = "i32")]
 
-int_module!(i32, 32)
+int_module! { i32, 32 }
diff --git a/src/libcore/num/i64.rs b/src/libcore/num/i64.rs
index 5832b2fdc03..b6cba728e44 100644
--- a/src/libcore/num/i64.rs
+++ b/src/libcore/num/i64.rs
@@ -13,4 +13,4 @@
 #![stable]
 #![doc(primitive = "i64")]
 
-int_module!(i64, 64)
+int_module! { i64, 64 }
diff --git a/src/libcore/num/i8.rs b/src/libcore/num/i8.rs
index 65cf5d2b1c1..fd0759898ea 100644
--- a/src/libcore/num/i8.rs
+++ b/src/libcore/num/i8.rs
@@ -13,4 +13,4 @@
 #![stable]
 #![doc(primitive = "i8")]
 
-int_module!(i8, 8)
+int_module! { i8, 8 }
diff --git a/src/libcore/num/int.rs b/src/libcore/num/int.rs
index 835246684df..a0659d38307 100644
--- a/src/libcore/num/int.rs
+++ b/src/libcore/num/int.rs
@@ -13,6 +13,6 @@
 #![unstable]
 #![doc(primitive = "int")]
 
-#[cfg(target_word_size = "32")] int_module!(int, 32)
-#[cfg(target_word_size = "64")] int_module!(int, 64)
+#[cfg(target_word_size = "32")] int_module! { int, 32 }
+#[cfg(target_word_size = "64")] int_module! { int, 64 }
 
diff --git a/src/libcore/num/int_macros.rs b/src/libcore/num/int_macros.rs
index 0f8950344c8..00b9d88abe1 100644
--- a/src/libcore/num/int_macros.rs
+++ b/src/libcore/num/int_macros.rs
@@ -11,7 +11,7 @@
 #![macro_escape]
 #![doc(hidden)]
 
-macro_rules! int_module (($T:ty, $bits:expr) => (
+macro_rules! int_module { ($T:ty, $bits:expr) => (
 
 // FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
 // calling the `mem::size_of` function.
@@ -32,4 +32,5 @@ pub const MIN: $T = (-1 as $T) << (BITS - 1);
 #[unstable]
 pub const MAX: $T = !MIN;
 
-))
+) }
+
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs
index 2416cf5bcc7..fcb2ca93054 100644
--- a/src/libcore/num/mod.rs
+++ b/src/libcore/num/mod.rs
@@ -458,61 +458,61 @@ macro_rules! uint_impl {
 /// consistency with the other `bswap` intrinsics.
 unsafe fn bswap8(x: u8) -> u8 { x }
 
-uint_impl!(u8 = u8, 8,
+uint_impl! { u8 = u8, 8,
     intrinsics::ctpop8,
     intrinsics::ctlz8,
     intrinsics::cttz8,
     bswap8,
     intrinsics::u8_add_with_overflow,
     intrinsics::u8_sub_with_overflow,
-    intrinsics::u8_mul_with_overflow)
+    intrinsics::u8_mul_with_overflow }
 
-uint_impl!(u16 = u16, 16,
+uint_impl! { u16 = u16, 16,
     intrinsics::ctpop16,
     intrinsics::ctlz16,
     intrinsics::cttz16,
     intrinsics::bswap16,
     intrinsics::u16_add_with_overflow,
     intrinsics::u16_sub_with_overflow,
-    intrinsics::u16_mul_with_overflow)
+    intrinsics::u16_mul_with_overflow }
 
-uint_impl!(u32 = u32, 32,
+uint_impl! { u32 = u32, 32,
     intrinsics::ctpop32,
     intrinsics::ctlz32,
     intrinsics::cttz32,
     intrinsics::bswap32,
     intrinsics::u32_add_with_overflow,
     intrinsics::u32_sub_with_overflow,
-    intrinsics::u32_mul_with_overflow)
+    intrinsics::u32_mul_with_overflow }
 
-uint_impl!(u64 = u64, 64,
+uint_impl! { u64 = u64, 64,
     intrinsics::ctpop64,
     intrinsics::ctlz64,
     intrinsics::cttz64,
     intrinsics::bswap64,
     intrinsics::u64_add_with_overflow,
     intrinsics::u64_sub_with_overflow,
-    intrinsics::u64_mul_with_overflow)
+    intrinsics::u64_mul_with_overflow }
 
 #[cfg(target_word_size = "32")]
-uint_impl!(uint = u32, 32,
+uint_impl! { uint = u32, 32,
     intrinsics::ctpop32,
     intrinsics::ctlz32,
     intrinsics::cttz32,
     intrinsics::bswap32,
     intrinsics::u32_add_with_overflow,
     intrinsics::u32_sub_with_overflow,
-    intrinsics::u32_mul_with_overflow)
+    intrinsics::u32_mul_with_overflow }
 
 #[cfg(target_word_size = "64")]
-uint_impl!(uint = u64, 64,
+uint_impl! { uint = u64, 64,
     intrinsics::ctpop64,
     intrinsics::ctlz64,
     intrinsics::cttz64,
     intrinsics::bswap64,
     intrinsics::u64_add_with_overflow,
     intrinsics::u64_sub_with_overflow,
-    intrinsics::u64_mul_with_overflow)
+    intrinsics::u64_mul_with_overflow }
 
 macro_rules! int_impl {
     ($T:ty = $ActualT:ty, $UnsignedT:ty, $BITS:expr,
@@ -579,37 +579,37 @@ macro_rules! int_impl {
     }
 }
 
-int_impl!(i8 = i8, u8, 8,
+int_impl! { i8 = i8, u8, 8,
     intrinsics::i8_add_with_overflow,
     intrinsics::i8_sub_with_overflow,
-    intrinsics::i8_mul_with_overflow)
+    intrinsics::i8_mul_with_overflow }
 
-int_impl!(i16 = i16, u16, 16,
+int_impl! { i16 = i16, u16, 16,
     intrinsics::i16_add_with_overflow,
     intrinsics::i16_sub_with_overflow,
-    intrinsics::i16_mul_with_overflow)
+    intrinsics::i16_mul_with_overflow }
 
-int_impl!(i32 = i32, u32, 32,
+int_impl! { i32 = i32, u32, 32,
     intrinsics::i32_add_with_overflow,
     intrinsics::i32_sub_with_overflow,
-    intrinsics::i32_mul_with_overflow)
+    intrinsics::i32_mul_with_overflow }
 
-int_impl!(i64 = i64, u64, 64,
+int_impl! { i64 = i64, u64, 64,
     intrinsics::i64_add_with_overflow,
     intrinsics::i64_sub_with_overflow,
-    intrinsics::i64_mul_with_overflow)
+    intrinsics::i64_mul_with_overflow }
 
 #[cfg(target_word_size = "32")]
-int_impl!(int = i32, u32, 32,
+int_impl! { int = i32, u32, 32,
     intrinsics::i32_add_with_overflow,
     intrinsics::i32_sub_with_overflow,
-    intrinsics::i32_mul_with_overflow)
+    intrinsics::i32_mul_with_overflow }
 
 #[cfg(target_word_size = "64")]
-int_impl!(int = i64, u64, 64,
+int_impl! { int = i64, u64, 64,
     intrinsics::i64_add_with_overflow,
     intrinsics::i64_sub_with_overflow,
-    intrinsics::i64_mul_with_overflow)
+    intrinsics::i64_mul_with_overflow }
 
 /// A built-in two's complement integer.
 #[unstable = "recently settled as part of numerics reform"]
@@ -663,11 +663,11 @@ macro_rules! signed_int_impl {
     }
 }
 
-signed_int_impl!(i8)
-signed_int_impl!(i16)
-signed_int_impl!(i32)
-signed_int_impl!(i64)
-signed_int_impl!(int)
+signed_int_impl! { i8 }
+signed_int_impl! { i16 }
+signed_int_impl! { i32 }
+signed_int_impl! { i64 }
+signed_int_impl! { int }
 
 /// A built-in unsigned integer.
 #[unstable = "recently settled as part of numerics reform"]
@@ -791,7 +791,7 @@ pub trait ToPrimitive {
     }
 }
 
-macro_rules! impl_to_primitive_int_to_int(
+macro_rules! impl_to_primitive_int_to_int {
     ($SrcT:ty, $DstT:ty, $slf:expr) => (
         {
             if size_of::<$SrcT>() <= size_of::<$DstT>() {
@@ -808,9 +808,9 @@ macro_rules! impl_to_primitive_int_to_int(
             }
         }
     )
-)
+}
 
-macro_rules! impl_to_primitive_int_to_uint(
+macro_rules! impl_to_primitive_int_to_uint {
     ($SrcT:ty, $DstT:ty, $slf:expr) => (
         {
             let zero: $SrcT = Int::zero();
@@ -822,9 +822,9 @@ macro_rules! impl_to_primitive_int_to_uint(
             }
         }
     )
-)
+}
 
-macro_rules! impl_to_primitive_int(
+macro_rules! impl_to_primitive_int {
     ($T:ty) => (
         impl ToPrimitive for $T {
             #[inline]
@@ -855,15 +855,15 @@ macro_rules! impl_to_primitive_int(
             fn to_f64(&self) -> Option<f64> { Some(*self as f64) }
         }
     )
-)
+}
 
-impl_to_primitive_int!(int)
-impl_to_primitive_int!(i8)
-impl_to_primitive_int!(i16)
-impl_to_primitive_int!(i32)
-impl_to_primitive_int!(i64)
+impl_to_primitive_int! { int }
+impl_to_primitive_int! { i8 }
+impl_to_primitive_int! { i16 }
+impl_to_primitive_int! { i32 }
+impl_to_primitive_int! { i64 }
 
-macro_rules! impl_to_primitive_uint_to_int(
+macro_rules! impl_to_primitive_uint_to_int {
     ($DstT:ty, $slf:expr) => (
         {
             let max_value: $DstT = Int::max_value();
@@ -874,9 +874,9 @@ macro_rules! impl_to_primitive_uint_to_int(
             }
         }
     )
-)
+}
 
-macro_rules! impl_to_primitive_uint_to_uint(
+macro_rules! impl_to_primitive_uint_to_uint {
     ($SrcT:ty, $DstT:ty, $slf:expr) => (
         {
             if size_of::<$SrcT>() <= size_of::<$DstT>() {
@@ -892,9 +892,9 @@ macro_rules! impl_to_primitive_uint_to_uint(
             }
         }
     )
-)
+}
 
-macro_rules! impl_to_primitive_uint(
+macro_rules! impl_to_primitive_uint {
     ($T:ty) => (
         impl ToPrimitive for $T {
             #[inline]
@@ -925,15 +925,15 @@ macro_rules! impl_to_primitive_uint(
             fn to_f64(&self) -> Option<f64> { Some(*self as f64) }
         }
     )
-)
+}
 
-impl_to_primitive_uint!(uint)
-impl_to_primitive_uint!(u8)
-impl_to_primitive_uint!(u16)
-impl_to_primitive_uint!(u32)
-impl_to_primitive_uint!(u64)
+impl_to_primitive_uint! { uint }
+impl_to_primitive_uint! { u8 }
+impl_to_primitive_uint! { u16 }
+impl_to_primitive_uint! { u32 }
+impl_to_primitive_uint! { u64 }
 
-macro_rules! impl_to_primitive_float_to_float(
+macro_rules! impl_to_primitive_float_to_float {
     ($SrcT:ty, $DstT:ty, $slf:expr) => (
         if size_of::<$SrcT>() <= size_of::<$DstT>() {
             Some($slf as $DstT)
@@ -947,9 +947,9 @@ macro_rules! impl_to_primitive_float_to_float(
             }
         }
     )
-)
+}
 
-macro_rules! impl_to_primitive_float(
+macro_rules! impl_to_primitive_float {
     ($T:ty) => (
         impl ToPrimitive for $T {
             #[inline]
@@ -980,10 +980,10 @@ macro_rules! impl_to_primitive_float(
             fn to_f64(&self) -> Option<f64> { impl_to_primitive_float_to_float!($T, f64, *self) }
         }
     )
-)
+}
 
-impl_to_primitive_float!(f32)
-impl_to_primitive_float!(f64)
+impl_to_primitive_float! { f32 }
+impl_to_primitive_float! { f64 }
 
 /// A generic trait for converting a number to a value.
 #[experimental = "trait is likely to be removed"]
@@ -1139,7 +1139,7 @@ pub fn from_f64<A: FromPrimitive>(n: f64) -> Option<A> {
     FromPrimitive::from_f64(n)
 }
 
-macro_rules! impl_from_primitive(
+macro_rules! impl_from_primitive {
     ($T:ty, $to_ty:ident) => (
         impl FromPrimitive for $T {
             #[inline] fn from_int(n: int) -> Option<$T> { n.$to_ty() }
@@ -1158,20 +1158,20 @@ macro_rules! impl_from_primitive(
             #[inline] fn from_f64(n: f64) -> Option<$T> { n.$to_ty() }
         }
     )
-)
-
-impl_from_primitive!(int, to_int)
-impl_from_primitive!(i8, to_i8)
-impl_from_primitive!(i16, to_i16)
-impl_from_primitive!(i32, to_i32)
-impl_from_primitive!(i64, to_i64)
-impl_from_primitive!(uint, to_uint)
-impl_from_primitive!(u8, to_u8)
-impl_from_primitive!(u16, to_u16)
-impl_from_primitive!(u32, to_u32)
-impl_from_primitive!(u64, to_u64)
-impl_from_primitive!(f32, to_f32)
-impl_from_primitive!(f64, to_f64)
+}
+
+impl_from_primitive! { int, to_int }
+impl_from_primitive! { i8, to_i8 }
+impl_from_primitive! { i16, to_i16 }
+impl_from_primitive! { i32, to_i32 }
+impl_from_primitive! { i64, to_i64 }
+impl_from_primitive! { uint, to_uint }
+impl_from_primitive! { u8, to_u8 }
+impl_from_primitive! { u16, to_u16 }
+impl_from_primitive! { u32, to_u32 }
+impl_from_primitive! { u64, to_u64 }
+impl_from_primitive! { f32, to_f32 }
+impl_from_primitive! { f64, to_f64 }
 
 /// Cast from one machine scalar to another.
 ///
@@ -1198,7 +1198,7 @@ pub trait NumCast: ToPrimitive {
     fn from<T: ToPrimitive>(n: T) -> Option<Self>;
 }
 
-macro_rules! impl_num_cast(
+macro_rules! impl_num_cast {
     ($T:ty, $conv:ident) => (
         impl NumCast for $T {
             #[inline]
@@ -1209,20 +1209,20 @@ macro_rules! impl_num_cast(
             }
         }
     )
-)
-
-impl_num_cast!(u8,    to_u8)
-impl_num_cast!(u16,   to_u16)
-impl_num_cast!(u32,   to_u32)
-impl_num_cast!(u64,   to_u64)
-impl_num_cast!(uint,  to_uint)
-impl_num_cast!(i8,    to_i8)
-impl_num_cast!(i16,   to_i16)
-impl_num_cast!(i32,   to_i32)
-impl_num_cast!(i64,   to_i64)
-impl_num_cast!(int,   to_int)
-impl_num_cast!(f32,   to_f32)
-impl_num_cast!(f64,   to_f64)
+}
+
+impl_num_cast! { u8,    to_u8 }
+impl_num_cast! { u16,   to_u16 }
+impl_num_cast! { u32,   to_u32 }
+impl_num_cast! { u64,   to_u64 }
+impl_num_cast! { uint,  to_uint }
+impl_num_cast! { i8,    to_i8 }
+impl_num_cast! { i16,   to_i16 }
+impl_num_cast! { i32,   to_i32 }
+impl_num_cast! { i64,   to_i64 }
+impl_num_cast! { int,   to_int }
+impl_num_cast! { f32,   to_f32 }
+impl_num_cast! { f64,   to_f64 }
 
 /// Used for representing the classification of floating point numbers
 #[deriving(PartialEq, Show)]
@@ -1638,8 +1638,8 @@ macro_rules! from_str_radix_float_impl {
         }
     }
 }
-from_str_radix_float_impl!(f32)
-from_str_radix_float_impl!(f64)
+from_str_radix_float_impl! { f32 }
+from_str_radix_float_impl! { f64 }
 
 macro_rules! from_str_radix_int_impl {
     ($T:ty) => {
@@ -1705,16 +1705,16 @@ macro_rules! from_str_radix_int_impl {
         }
     }
 }
-from_str_radix_int_impl!(int)
-from_str_radix_int_impl!(i8)
-from_str_radix_int_impl!(i16)
-from_str_radix_int_impl!(i32)
-from_str_radix_int_impl!(i64)
-from_str_radix_int_impl!(uint)
-from_str_radix_int_impl!(u8)
-from_str_radix_int_impl!(u16)
-from_str_radix_int_impl!(u32)
-from_str_radix_int_impl!(u64)
+from_str_radix_int_impl! { int }
+from_str_radix_int_impl! { i8 }
+from_str_radix_int_impl! { i16 }
+from_str_radix_int_impl! { i32 }
+from_str_radix_int_impl! { i64 }
+from_str_radix_int_impl! { uint }
+from_str_radix_int_impl! { u8 }
+from_str_radix_int_impl! { u16 }
+from_str_radix_int_impl! { u32 }
+from_str_radix_int_impl! { u64 }
 
 // DEPRECATED
 
@@ -1733,17 +1733,17 @@ pub trait Num: PartialEq + Zero + One
              + Mul<Self,Self>
              + Div<Self,Self>
              + Rem<Self,Self> {}
-trait_impl!(Num for uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64)
+trait_impl! { Num for uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
 
 #[deprecated = "Generalised unsigned numbers are no longer supported"]
 #[allow(deprecated)]
 pub trait Unsigned: Num {}
-trait_impl!(Unsigned for uint u8 u16 u32 u64)
+trait_impl! { Unsigned for uint u8 u16 u32 u64 }
 
 #[deprecated = "Use `Float` or `Int`"]
 #[allow(deprecated)]
 pub trait Primitive: Copy + Clone + Num + NumCast + PartialOrd {}
-trait_impl!(Primitive for uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64)
+trait_impl! { Primitive for uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
 
 #[deprecated = "The generic `Zero` trait will be removed soon."]
 pub trait Zero: Add<Self, Self> {
@@ -1763,18 +1763,18 @@ macro_rules! zero_impl {
         }
     }
 }
-zero_impl!(uint, 0u)
-zero_impl!(u8,   0u8)
-zero_impl!(u16,  0u16)
-zero_impl!(u32,  0u32)
-zero_impl!(u64,  0u64)
-zero_impl!(int, 0i)
-zero_impl!(i8,  0i8)
-zero_impl!(i16, 0i16)
-zero_impl!(i32, 0i32)
-zero_impl!(i64, 0i64)
-zero_impl!(f32, 0.0f32)
-zero_impl!(f64, 0.0f64)
+zero_impl! { uint, 0u }
+zero_impl! { u8,   0u8 }
+zero_impl! { u16,  0u16 }
+zero_impl! { u32,  0u32 }
+zero_impl! { u64,  0u64 }
+zero_impl! { int, 0i }
+zero_impl! { i8,  0i8 }
+zero_impl! { i16, 0i16 }
+zero_impl! { i32, 0i32 }
+zero_impl! { i64, 0i64 }
+zero_impl! { f32, 0.0f32 }
+zero_impl! { f64, 0.0f64 }
 
 #[deprecated = "The generic `One` trait will be removed soon."]
 pub trait One: Mul<Self, Self> {
@@ -1791,18 +1791,18 @@ macro_rules! one_impl {
         }
     }
 }
-one_impl!(uint, 1u)
-one_impl!(u8,  1u8)
-one_impl!(u16, 1u16)
-one_impl!(u32, 1u32)
-one_impl!(u64, 1u64)
-one_impl!(int, 1i)
-one_impl!(i8,  1i8)
-one_impl!(i16, 1i16)
-one_impl!(i32, 1i32)
-one_impl!(i64, 1i64)
-one_impl!(f32, 1.0f32)
-one_impl!(f64, 1.0f64)
+one_impl! { uint, 1u }
+one_impl! { u8,  1u8 }
+one_impl! { u16, 1u16 }
+one_impl! { u32, 1u32 }
+one_impl! { u64, 1u64 }
+one_impl! { int, 1i }
+one_impl! { i8,  1i8 }
+one_impl! { i16, 1i16 }
+one_impl! { i32, 1i32 }
+one_impl! { i64, 1i64 }
+one_impl! { f32, 1.0f32 }
+one_impl! { f64, 1.0f64 }
 
 #[deprecated = "Use `UnsignedInt::next_power_of_two`"]
 pub fn next_power_of_two<T: UnsignedInt>(n: T) -> T {
@@ -1835,15 +1835,15 @@ macro_rules! bounded_impl {
         }
     };
 }
-bounded_impl!(uint, uint::MIN, uint::MAX)
-bounded_impl!(u8, u8::MIN, u8::MAX)
-bounded_impl!(u16, u16::MIN, u16::MAX)
-bounded_impl!(u32, u32::MIN, u32::MAX)
-bounded_impl!(u64, u64::MIN, u64::MAX)
-bounded_impl!(int, int::MIN, int::MAX)
-bounded_impl!(i8, i8::MIN, i8::MAX)
-bounded_impl!(i16, i16::MIN, i16::MAX)
-bounded_impl!(i32, i32::MIN, i32::MAX)
-bounded_impl!(i64, i64::MIN, i64::MAX)
-bounded_impl!(f32, f32::MIN_VALUE, f32::MAX_VALUE)
-bounded_impl!(f64, f64::MIN_VALUE, f64::MAX_VALUE)
+bounded_impl! { uint, uint::MIN, uint::MAX }
+bounded_impl! { u8, u8::MIN, u8::MAX }
+bounded_impl! { u16, u16::MIN, u16::MAX }
+bounded_impl! { u32, u32::MIN, u32::MAX }
+bounded_impl! { u64, u64::MIN, u64::MAX }
+bounded_impl! { int, int::MIN, int::MAX }
+bounded_impl! { i8, i8::MIN, i8::MAX }
+bounded_impl! { i16, i16::MIN, i16::MAX }
+bounded_impl! { i32, i32::MIN, i32::MAX }
+bounded_impl! { i64, i64::MIN, i64::MAX }
+bounded_impl! { f32, f32::MIN_VALUE, f32::MAX_VALUE }
+bounded_impl! { f64, f64::MIN_VALUE, f64::MAX_VALUE }
diff --git a/src/libcore/num/u16.rs b/src/libcore/num/u16.rs
index 6971de279fa..730a24a963a 100644
--- a/src/libcore/num/u16.rs
+++ b/src/libcore/num/u16.rs
@@ -13,4 +13,4 @@
 #![stable]
 #![doc(primitive = "u16")]
 
-uint_module!(u16, i16, 16)
+uint_module! { u16, i16, 16 }
diff --git a/src/libcore/num/u32.rs b/src/libcore/num/u32.rs
index 26affc3f790..f308122af43 100644
--- a/src/libcore/num/u32.rs
+++ b/src/libcore/num/u32.rs
@@ -13,4 +13,4 @@
 #![stable]
 #![doc(primitive = "u32")]
 
-uint_module!(u32, i32, 32)
+uint_module! { u32, i32, 32 }
diff --git a/src/libcore/num/u64.rs b/src/libcore/num/u64.rs
index 3b50d033001..a55868eb746 100644
--- a/src/libcore/num/u64.rs
+++ b/src/libcore/num/u64.rs
@@ -13,4 +13,4 @@
 #![stable]
 #![doc(primitive = "u64")]
 
-uint_module!(u64, i64, 64)
+uint_module! { u64, i64, 64 }
diff --git a/src/libcore/num/u8.rs b/src/libcore/num/u8.rs
index ce7d767aee4..8643f8ad650 100644
--- a/src/libcore/num/u8.rs
+++ b/src/libcore/num/u8.rs
@@ -13,4 +13,4 @@
 #![stable]
 #![doc(primitive = "u8")]
 
-uint_module!(u8, i8, 8)
+uint_module! { u8, i8, 8 }
diff --git a/src/libcore/num/uint.rs b/src/libcore/num/uint.rs
index 62d2f11e541..80d7b0b4ef3 100644
--- a/src/libcore/num/uint.rs
+++ b/src/libcore/num/uint.rs
@@ -13,5 +13,5 @@
 #![unstable]
 #![doc(primitive = "uint")]
 
-uint_module!(uint, int, ::int::BITS)
+uint_module! { uint, int, ::int::BITS }
 
diff --git a/src/libcore/num/uint_macros.rs b/src/libcore/num/uint_macros.rs
index 2a94f851646..d79cf20fdfa 100644
--- a/src/libcore/num/uint_macros.rs
+++ b/src/libcore/num/uint_macros.rs
@@ -11,7 +11,7 @@
 #![macro_escape]
 #![doc(hidden)]
 
-macro_rules! uint_module (($T:ty, $T_SIGNED:ty, $bits:expr) => (
+macro_rules! uint_module { ($T:ty, $T_SIGNED:ty, $bits:expr) => (
 
 #[unstable]
 pub const BITS : uint = $bits;
@@ -23,4 +23,5 @@ pub const MIN: $T = 0 as $T;
 #[unstable]
 pub const MAX: $T = 0 as $T - 1 as $T;
 
-))
+) }
+