Skip to content

Instantly share code, notes, and snippets.

@huonw
Forked from brson/gist:8366039
Created January 11, 2014 02:06
Show Gist options
  • Save huonw/8366072 to your computer and use it in GitHub Desktop.
Save huonw/8366072 to your computer and use it in GitHub Desktop.
macro_rules! report_diag (
($f: tt, $name: tt, $msg: tt, $(arg: tt)*) => { {
reg_diag_msg!($name, $msg);
let msg = format!($msg, $($arg)*);
let msg = format!("{}: {}", stringify!($name), msg);
$f(msg);
} };
($f: tt, $name: tt, $msg: tt) => { {
reg_diag_msg!($name, $msg);
let msg = format!("{}: {}", stringify!($name), $msg);
$f(msg);
} }
)
macro_rules! alert_err (
($sess: expr, $name: tt, $msg: tt, $($arg: tt)*) => (
report_diag!($sess.err, $name, $msg, $($arg)*);
);
($sess: expr, $name: tt, $msg: tt) => (
report_diag!($sess.err, $name, $msg);
)
)
../src/librustc/diag_macros.rs:95:29: 95:30 error: No rules expected the token: .
../src/librustc/diag_macros.rs:95 report_diag!($sess.err, $name, $msg, $($arg)*);
^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment