about summary refs log tree commit diff
path: root/src/libcoretest
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/libcoretest
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/libcoretest')
-rw-r--r--src/libcoretest/iter.rs20
-rw-r--r--src/libcoretest/num/i16.rs2
-rw-r--r--src/libcoretest/num/i32.rs2
-rw-r--r--src/libcoretest/num/i64.rs2
-rw-r--r--src/libcoretest/num/i8.rs2
-rw-r--r--src/libcoretest/num/int.rs2
-rw-r--r--src/libcoretest/num/int_macros.rs2
-rw-r--r--src/libcoretest/num/mod.rs4
-rw-r--r--src/libcoretest/num/u16.rs2
-rw-r--r--src/libcoretest/num/u32.rs2
-rw-r--r--src/libcoretest/num/u64.rs2
-rw-r--r--src/libcoretest/num/u8.rs2
-rw-r--r--src/libcoretest/num/uint.rs2
-rw-r--r--src/libcoretest/num/uint_macros.rs2
14 files changed, 24 insertions, 24 deletions
diff --git a/src/libcoretest/iter.rs b/src/libcoretest/iter.rs
index 0bcebe073a3..dbbbaa5892c 100644
--- a/src/libcoretest/iter.rs
+++ b/src/libcoretest/iter.rs
@@ -522,15 +522,15 @@ fn test_double_ended_chain() {
     let xs = [1i, 2, 3, 4, 5];
     let ys = [7i, 9, 11];
     let mut it = xs.iter().chain(ys.iter()).rev();
-    assert_eq!(it.next().unwrap(), &11)
-    assert_eq!(it.next().unwrap(), &9)
-    assert_eq!(it.next_back().unwrap(), &1)
-    assert_eq!(it.next_back().unwrap(), &2)
-    assert_eq!(it.next_back().unwrap(), &3)
-    assert_eq!(it.next_back().unwrap(), &4)
-    assert_eq!(it.next_back().unwrap(), &5)
-    assert_eq!(it.next_back().unwrap(), &7)
-    assert_eq!(it.next_back(), None)
+    assert_eq!(it.next().unwrap(), &11);
+    assert_eq!(it.next().unwrap(), &9);
+    assert_eq!(it.next_back().unwrap(), &1);
+    assert_eq!(it.next_back().unwrap(), &2);
+    assert_eq!(it.next_back().unwrap(), &3);
+    assert_eq!(it.next_back().unwrap(), &4);
+    assert_eq!(it.next_back().unwrap(), &5);
+    assert_eq!(it.next_back().unwrap(), &7);
+    assert_eq!(it.next_back(), None);
 }
 
 #[test]
@@ -800,7 +800,7 @@ fn test_min_max() {
 #[test]
 fn test_min_max_result() {
     let r: MinMaxResult<int> = NoElements;
-    assert_eq!(r.into_option(), None)
+    assert_eq!(r.into_option(), None);
 
     let r = OneElement(1i);
     assert_eq!(r.into_option(), Some((1,1)));
diff --git a/src/libcoretest/num/i16.rs b/src/libcoretest/num/i16.rs
index f3c2d67cdeb..7435831ac6d 100644
--- a/src/libcoretest/num/i16.rs
+++ b/src/libcoretest/num/i16.rs
@@ -8,4 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-int_module!(i16, i16)
+int_module!(i16, i16);
diff --git a/src/libcoretest/num/i32.rs b/src/libcoretest/num/i32.rs
index 7232fc7505d..3b3407e1ada 100644
--- a/src/libcoretest/num/i32.rs
+++ b/src/libcoretest/num/i32.rs
@@ -8,4 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-int_module!(i32, i32)
+int_module!(i32, i32);
diff --git a/src/libcoretest/num/i64.rs b/src/libcoretest/num/i64.rs
index 075b8448f35..9e1aec256ee 100644
--- a/src/libcoretest/num/i64.rs
+++ b/src/libcoretest/num/i64.rs
@@ -8,4 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-int_module!(i64, i64)
+int_module!(i64, i64);
diff --git a/src/libcoretest/num/i8.rs b/src/libcoretest/num/i8.rs
index 9e0439f2818..f72244239b2 100644
--- a/src/libcoretest/num/i8.rs
+++ b/src/libcoretest/num/i8.rs
@@ -8,4 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-int_module!(i8, i8)
+int_module!(i8, i8);
diff --git a/src/libcoretest/num/int.rs b/src/libcoretest/num/int.rs
index f01ec3f0310..be8dfd02ee1 100644
--- a/src/libcoretest/num/int.rs
+++ b/src/libcoretest/num/int.rs
@@ -8,4 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-int_module!(int, int)
+int_module!(int, int);
diff --git a/src/libcoretest/num/int_macros.rs b/src/libcoretest/num/int_macros.rs
index 87e2fe75299..55e0f10c865 100644
--- a/src/libcoretest/num/int_macros.rs
+++ b/src/libcoretest/num/int_macros.rs
@@ -202,4 +202,4 @@ mod tests {
     }
 }
 
-))
+));
diff --git a/src/libcoretest/num/mod.rs b/src/libcoretest/num/mod.rs
index b7f8b81f996..acc593d7be9 100644
--- a/src/libcoretest/num/mod.rs
+++ b/src/libcoretest/num/mod.rs
@@ -62,9 +62,9 @@ mod test {
         let s : Option<i16> = from_str_radix("80000", 10);
         assert_eq!(s, None);
         let f : Option<f32> = from_str_radix("10000000000000000000000000000000000000000", 10);
-        assert_eq!(f, Some(Float::infinity()))
+        assert_eq!(f, Some(Float::infinity()));
         let fe : Option<f32> = from_str_radix("1e40", 10);
-        assert_eq!(fe, Some(Float::infinity()))
+        assert_eq!(fe, Some(Float::infinity()));
     }
 
     #[test]
diff --git a/src/libcoretest/num/u16.rs b/src/libcoretest/num/u16.rs
index d6aa6476678..8455207583c 100644
--- a/src/libcoretest/num/u16.rs
+++ b/src/libcoretest/num/u16.rs
@@ -8,4 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-uint_module!(u16, u16)
+uint_module!(u16, u16);
diff --git a/src/libcoretest/num/u32.rs b/src/libcoretest/num/u32.rs
index 218e79df5ae..b44e60f6529 100644
--- a/src/libcoretest/num/u32.rs
+++ b/src/libcoretest/num/u32.rs
@@ -8,4 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-uint_module!(u32, u32)
+uint_module!(u32, u32);
diff --git a/src/libcoretest/num/u64.rs b/src/libcoretest/num/u64.rs
index f78d4813503..ffcd1015d58 100644
--- a/src/libcoretest/num/u64.rs
+++ b/src/libcoretest/num/u64.rs
@@ -8,4 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-uint_module!(u64, u64)
+uint_module!(u64, u64);
diff --git a/src/libcoretest/num/u8.rs b/src/libcoretest/num/u8.rs
index bb08072320b..4ee14e22f2d 100644
--- a/src/libcoretest/num/u8.rs
+++ b/src/libcoretest/num/u8.rs
@@ -8,4 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-uint_module!(u8, u8)
+uint_module!(u8, u8);
diff --git a/src/libcoretest/num/uint.rs b/src/libcoretest/num/uint.rs
index 0db865f4cde..395e55cf255 100644
--- a/src/libcoretest/num/uint.rs
+++ b/src/libcoretest/num/uint.rs
@@ -8,4 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-uint_module!(uint, uint)
+uint_module!(uint, uint);
diff --git a/src/libcoretest/num/uint_macros.rs b/src/libcoretest/num/uint_macros.rs
index 5657a43de19..b21ac11e6a0 100644
--- a/src/libcoretest/num/uint_macros.rs
+++ b/src/libcoretest/num/uint_macros.rs
@@ -124,4 +124,4 @@ mod tests {
         assert!(5u.checked_div(0) == None);
     }
 }
-))
+));