From 75ee8f156204cef3140d6e153d36f9970ca2bfa1 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Fri, 7 Aug 2015 10:28:51 -0400 Subject: 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. --- src/libsyntax/diagnostics/macros.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/libsyntax') 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 @@ -30,6 +30,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)*) => ({ -- cgit 1.4.1-3-g733a5