From 2c3e5d3de023c0bfbf4a4c4d3b0d7a9844e96ffe Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Tue, 31 Dec 2019 21:25:16 +0100 Subject: - remove syntax::{span_warn!, span_err!, span_fatal!. struct_err!} - remove syntax::{help!, span_help!, span_note!} - remove unused syntax::{struct_span_fatal, struct_span_err_or_warn!, span_err_or_warn!} - lintify check_for_bindings_named_same_as_variants + conflicting_repr_hints - inline syntax::{struct_span_warn!, diagnostic_used!} - stringify_error_code! -> error_code! & use it more. - find_plugin_registrar: de-fatalize an error - de-fatalize metadata errors - move type_error_struct! to rustc_typeck - struct_span_err! -> rustc_errors --- src/librustc_errors/diagnostic_builder.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/librustc_errors') diff --git a/src/librustc_errors/diagnostic_builder.rs b/src/librustc_errors/diagnostic_builder.rs index 79ec9ad7b03..73f66d55037 100644 --- a/src/librustc_errors/diagnostic_builder.rs +++ b/src/librustc_errors/diagnostic_builder.rs @@ -385,3 +385,22 @@ impl<'a> Drop for DiagnosticBuilder<'a> { } } } + +#[macro_export] +macro_rules! struct_span_err { + ($session:expr, $span:expr, $code:ident, $($message:tt)*) => ({ + $session.struct_span_err_with_code( + $span, + &format!($($message)*), + $crate::error_code!($code), + ) + }) +} + +#[macro_export] +macro_rules! error_code { + ($code:ident) => {{ + let _ = $code; + $crate::DiagnosticId::Error(stringify!($code).to_owned()) + }}; +} -- cgit 1.4.1-3-g733a5