about summary refs log tree commit diff
path: root/src/libsyntax/diagnostics/macros.rs
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2015-08-07 10:28:51 -0400
committerNiko Matsakis <niko@alum.mit.edu>2015-08-12 17:58:22 -0400
commit75ee8f156204cef3140d6e153d36f9970ca2bfa1 (patch)
tree6bd154df8cee3efa70a947b8230ef68c52eec19d /src/libsyntax/diagnostics/macros.rs
parent39d164d0421a7560ea1e35a2347fda223cd43f6e (diff)
downloadrust-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.rs12
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);