diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2015-08-07 10:28:51 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2015-08-12 17:58:22 -0400 |
| commit | 75ee8f156204cef3140d6e153d36f9970ca2bfa1 (patch) | |
| tree | 6bd154df8cee3efa70a947b8230ef68c52eec19d /src/libsyntax/diagnostics/macros.rs | |
| parent | 39d164d0421a7560ea1e35a2347fda223cd43f6e (diff) | |
| download | rust-75ee8f156204cef3140d6e153d36f9970ca2bfa1.tar.gz rust-75ee8f156204cef3140d6e153d36f9970ca2bfa1.zip | |
Introduce a "origin/cause" for new requirements (or bugfixes...) introduced by RFC 1214,
and issue a warning (and explanatory note) when we encounter such a thing.
Diffstat (limited to 'src/libsyntax/diagnostics/macros.rs')
| -rw-r--r-- | src/libsyntax/diagnostics/macros.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libsyntax/diagnostics/macros.rs b/src/libsyntax/diagnostics/macros.rs index 669b930ecc9..3c8347f8a8e 100644 --- a/src/libsyntax/diagnostics/macros.rs +++ b/src/libsyntax/diagnostics/macros.rs @@ -31,6 +31,18 @@ macro_rules! span_err { } #[macro_export] +macro_rules! span_err_or_warn { + ($is_warning:expr, $session:expr, $span:expr, $code:ident, $($message:tt)*) => ({ + __diagnostic_used!($code); + if $is_warning { + $session.span_warn_with_code($span, &format!($($message)*), stringify!($code)) + } else { + $session.span_err_with_code($span, &format!($($message)*), stringify!($code)) + } + }) +} + +#[macro_export] macro_rules! span_warn { ($session:expr, $span:expr, $code:ident, $($message:tt)*) => ({ __diagnostic_used!($code); |
