about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-01-06 15:49:15 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-01-06 15:49:15 -0800
commit26cd8eae48ea99bda183c5224bc423991ccfaf1f (patch)
tree26492380aa79b1b1f70acb2a624e30ca097374df /src/libcore
parent34a63d336419e80d3afec16c730d1ad5fa11dc73 (diff)
parente9cbdd866d1c9c01e9affaf6875e37e58a073758 (diff)
downloadrust-26cd8eae48ea99bda183c5224bc423991ccfaf1f.tar.gz
rust-26cd8eae48ea99bda183c5224bc423991ccfaf1f.zip
rollup merge of #20563: cmr/macro-input-future-proofing
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/macros.rs9
-rw-r--r--src/libcore/str/mod.rs21
2 files changed, 16 insertions, 14 deletions
diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs
index d01621fc6d8..00bfe56a622 100644
--- a/src/libcore/macros.rs
+++ b/src/libcore/macros.rs
@@ -179,9 +179,12 @@ macro_rules! write {
 #[macro_export]
 #[stable]
 macro_rules! writeln {
-    ($dst:expr, $fmt:expr $($arg:tt)*) => (
-        write!($dst, concat!($fmt, "\n") $($arg)*)
-    )
+    ($dst:expr, $fmt:expr) => (
+        write!($dst, concat!($fmt, "\n"))
+    );
+    ($dst:expr, $fmt:expr, $($arg:expr),*) => (
+        write!($dst, concat!($fmt, "\n"), $($arg,)*)
+    );
 }
 
 /// A utility macro for indicating unreachable code.
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs
index d633f822ff7..3f8ce000e21 100644
--- a/src/libcore/str/mod.rs
+++ b/src/libcore/str/mod.rs
@@ -35,9 +35,8 @@ use slice::{self, SliceExt};
 use uint;
 
 macro_rules! delegate_iter {
-    (exact $te:ty in $ti:ty) => {
-        delegate_iter!{$te in $ti}
-        #[stable]
+    (exact $te:ty : $ti:ty) => {
+        delegate_iter!{$te : $ti}
         impl<'a> ExactSizeIterator for $ti {
             #[inline]
             fn len(&self) -> uint {
@@ -45,7 +44,7 @@ macro_rules! delegate_iter {
             }
         }
     };
-    ($te:ty in $ti:ty) => {
+    ($te:ty : $ti:ty) => {
         #[stable]
         impl<'a> Iterator for $ti {
             type Item = $te;
@@ -67,7 +66,7 @@ macro_rules! delegate_iter {
             }
         }
     };
-    (pattern $te:ty in $ti:ty) => {
+    (pattern $te:ty : $ti:ty) => {
         #[stable]
         impl<'a, P: CharEq> Iterator for $ti {
             type Item = $te;
@@ -89,7 +88,7 @@ macro_rules! delegate_iter {
             }
         }
     };
-    (pattern forward $te:ty in $ti:ty) => {
+    (pattern forward $te:ty : $ti:ty) => {
         #[stable]
         impl<'a, P: CharEq> Iterator for $ti {
             type Item = $te;
@@ -415,7 +414,7 @@ impl<'a> DoubleEndedIterator for CharIndices<'a> {
 #[stable]
 #[derive(Clone)]
 pub struct Bytes<'a>(Map<&'a u8, u8, slice::Iter<'a, u8>, BytesDeref>);
-delegate_iter!{exact u8 in Bytes<'a>}
+delegate_iter!{exact u8 : Bytes<'a>}
 
 /// A temporary fn new type that ensures that the `Bytes` iterator
 /// is cloneable.
@@ -1172,25 +1171,25 @@ impl<'a, S: ?Sized> Str for &'a S where S: Str {
 #[derive(Clone)]
 #[stable]
 pub struct Split<'a, P>(CharSplits<'a, P>);
-delegate_iter!{pattern &'a str in Split<'a, P>}
+delegate_iter!{pattern &'a str : Split<'a, P>}
 
 /// Return type of `StrExt::split_terminator`
 #[derive(Clone)]
 #[unstable = "might get removed in favour of a constructor method on Split"]
 pub struct SplitTerminator<'a, P>(CharSplits<'a, P>);
-delegate_iter!{pattern &'a str in SplitTerminator<'a, P>}
+delegate_iter!{pattern &'a str : SplitTerminator<'a, P>}
 
 /// Return type of `StrExt::splitn`
 #[derive(Clone)]
 #[stable]
 pub struct SplitN<'a, P>(CharSplitsN<'a, P>);
-delegate_iter!{pattern forward &'a str in SplitN<'a, P>}
+delegate_iter!{pattern forward &'a str : SplitN<'a, P>}
 
 /// Return type of `StrExt::rsplitn`
 #[derive(Clone)]
 #[stable]
 pub struct RSplitN<'a, P>(CharSplitsN<'a, P>);
-delegate_iter!{pattern forward &'a str in RSplitN<'a, P>}
+delegate_iter!{pattern forward &'a str : RSplitN<'a, P>}
 
 /// Methods for string slices
 #[allow(missing_docs)]