diff options
| author | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2017-10-27 08:21:22 +0200 |
|---|---|---|
| committer | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2017-11-02 10:19:41 +0100 |
| commit | 6ae440e04806ef2a9d21df4ee6f9e0006db5b05f (patch) | |
| tree | 9e32f9822b288a844c88833d0e1b1d8294def353 /src/libsyntax/diagnostics/macros.rs | |
| parent | 88fb4c4fdad1b97c3499a26e24dcbc60c6853a80 (diff) | |
| download | rust-6ae440e04806ef2a9d21df4ee6f9e0006db5b05f.tar.gz rust-6ae440e04806ef2a9d21df4ee6f9e0006db5b05f.zip | |
Make the difference between lint codes and error codes explicit
Diffstat (limited to 'src/libsyntax/diagnostics/macros.rs')
| -rw-r--r-- | src/libsyntax/diagnostics/macros.rs | 65 |
1 files changed, 54 insertions, 11 deletions
diff --git a/src/libsyntax/diagnostics/macros.rs b/src/libsyntax/diagnostics/macros.rs index e8ecf58072a..c01836b6194 100644 --- a/src/libsyntax/diagnostics/macros.rs +++ b/src/libsyntax/diagnostics/macros.rs @@ -18,7 +18,11 @@ macro_rules! register_diagnostic { macro_rules! span_fatal { ($session:expr, $span:expr, $code:ident, $($message:tt)*) => ({ __diagnostic_used!($code); - $session.span_fatal_with_code($span, &format!($($message)*), stringify!($code)) + $session.span_fatal_with_code( + $span, + &format!($($message)*), + $crate::errors::DiagnosticId::Error(stringify!($code).to_owned()), + ) }) } @@ -26,7 +30,11 @@ macro_rules! span_fatal { macro_rules! span_err { ($session:expr, $span:expr, $code:ident, $($message:tt)*) => ({ __diagnostic_used!($code); - $session.span_err_with_code($span, &format!($($message)*), stringify!($code)) + $session.span_err_with_code( + $span, + &format!($($message)*), + $crate::errors::DiagnosticId::Error(stringify!($code).to_owned()), + ) }) } @@ -34,7 +42,11 @@ macro_rules! span_err { macro_rules! span_warn { ($session:expr, $span:expr, $code:ident, $($message:tt)*) => ({ __diagnostic_used!($code); - $session.span_warn_with_code($span, &format!($($message)*), stringify!($code)) + $session.span_warn_with_code( + $span, + &format!($($message)*), + $crate::errors::DiagnosticId::Error(stringify!($code).to_owned()), + ) }) } @@ -42,7 +54,10 @@ macro_rules! span_warn { macro_rules! struct_err { ($session:expr, $code:ident, $($message:tt)*) => ({ __diagnostic_used!($code); - $session.struct_err_with_code(&format!($($message)*), stringify!($code)) + $session.struct_err_with_code( + &format!($($message)*), + $crate::errors::DiagnosticId::Error(stringify!($code).to_owned()), + ) }) } @@ -51,9 +66,17 @@ 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)) + $session.span_warn_with_code( + $span, + &format!($($message)*), + $crate::errors::DiagnosticId::Error(stringify!($code).to_owned()), + ) } else { - $session.span_err_with_code($span, &format!($($message)*), stringify!($code)) + $session.span_err_with_code( + $span, + &format!($($message)*), + $crate::errors::DiagnosticId::Error(stringify!($code).to_owned()), + ) } }) } @@ -62,7 +85,11 @@ macro_rules! span_err_or_warn { macro_rules! struct_span_fatal { ($session:expr, $span:expr, $code:ident, $($message:tt)*) => ({ __diagnostic_used!($code); - $session.struct_span_fatal_with_code($span, &format!($($message)*), stringify!($code)) + $session.struct_span_fatal_with_code( + $span, + &format!($($message)*), + $crate::errors::DiagnosticId::Error(stringify!($code).to_owned()), + ) }) } @@ -70,7 +97,11 @@ macro_rules! struct_span_fatal { macro_rules! struct_span_err { ($session:expr, $span:expr, $code:ident, $($message:tt)*) => ({ __diagnostic_used!($code); - $session.struct_span_err_with_code($span, &format!($($message)*), stringify!($code)) + $session.struct_span_err_with_code( + $span, + &format!($($message)*), + $crate::errors::DiagnosticId::Error(stringify!($code).to_owned()), + ) }) } @@ -89,7 +120,11 @@ macro_rules! type_error_struct { macro_rules! struct_span_warn { ($session:expr, $span:expr, $code:ident, $($message:tt)*) => ({ __diagnostic_used!($code); - $session.struct_span_warn_with_code($span, &format!($($message)*), stringify!($code)) + $session.struct_span_warn_with_code( + $span, + &format!($($message)*), + $crate::errors::DiagnosticId::Error(stringify!($code).to_owned()), + ) }) } @@ -98,9 +133,17 @@ macro_rules! struct_span_err_or_warn { ($is_warning:expr, $session:expr, $span:expr, $code:ident, $($message:tt)*) => ({ __diagnostic_used!($code); if $is_warning { - $session.struct_span_warn_with_code($span, &format!($($message)*), stringify!($code)) + $session.struct_span_warn_with_code( + $span, + &format!($($message)*), + $crate::errors::DiagnosticId::Error(stringify!($code).to_owned()), + ) } else { - $session.struct_span_err_with_code($span, &format!($($message)*), stringify!($code)) + $session.struct_span_err_with_code( + $span, + &format!($($message)*), + $crate::errors::DiagnosticId::Error(stringify!($code).to_owned()), + ) } }) } |
