From bd4119f9654eda89e359234a08b1ac4fae53287c Mon Sep 17 00:00:00 2001 From: Corey Richardson Date: Tue, 6 Jan 2015 18:46:37 -0500 Subject: [PATCH] Minor fallout/update FOLLOW sets --- src/libcore/macros.rs | 8 ++++---- src/libstd/rt/macros.rs | 16 ++++++++++++---- src/libsyntax/ext/tt/macro_rules.rs | 4 ++-- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index 14e0be2cf166a..fcd93ad4a02ae 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -186,12 +186,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/libstd/rt/macros.rs b/src/libstd/rt/macros.rs index bbc96d0b19f12..1e3ab6d34dab9 100644 --- a/src/libstd/rt/macros.rs +++ b/src/libstd/rt/macros.rs @@ -14,16 +14,24 @@ //! they aren't defined anywhere outside of the `rt` module. macro_rules! rterrln { - ($fmt:expr $($arg:tt)*) => ( { - ::rt::util::dumb_print(format_args!(concat!($fmt, "\n") $($arg)*)) + ($fmt:expr) => ( { + ::rt::util::dumb_print(format_args!(concat!($fmt, "\n"))) + } ); + ($fmt:expr, $($arg:expr),*) => ( { + ::rt::util::dumb_print(format_args!(concat!($fmt, "\n"), $($arg)*)) } ) } // Some basic logging. Enabled by passing `--cfg rtdebug` to the libstd build. macro_rules! rtdebug { - ($($arg:tt)*) => ( { + ($arg:expr) => ( { if cfg!(rtdebug) { - rterrln!($($arg)*) + rterrln!($arg) + } + } ); + ($str:expr, $($arg:expr),*) => ( { + if cfg!(rtdebug) { + rterrln!($str, $($arg)*) } }) } diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 9e1b18ad18a85..6a064ec131356 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -422,7 +422,7 @@ fn is_in_follow(cx: &ExtCtxt, tok: &Token, frag: &str) -> bool { }, "stmt" | "expr" => { match *tok { - Comma | Semi => true, + FatArrow | Comma | Semi => true, _ => false } }, @@ -434,7 +434,7 @@ fn is_in_follow(cx: &ExtCtxt, tok: &Token, frag: &str) -> bool { }, "path" | "ty" => { match *tok { - Comma | RArrow | Colon | Eq | Gt => true, + Comma | FatArrow | Colon | Eq | Gt => true, Ident(i, _) if i.as_str() == "as" => true, _ => false }