X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc_errors%2Fdiagnostic_builder.rs;h=3c217c1d64373556cdd9605e89605d22d836cede;hb=f998e275cae5320e75871c626c0f88eaef83d5e4;hp=79ec9ad7b03297812b3550a0677bc7513728c170;hpb=766fba3fdca8fe075c370a63d2f76f8407483af5;p=rust.git diff --git a/src/librustc_errors/diagnostic_builder.rs b/src/librustc_errors/diagnostic_builder.rs index 79ec9ad7b03..3c217c1d643 100644 --- a/src/librustc_errors/diagnostic_builder.rs +++ b/src/librustc_errors/diagnostic_builder.rs @@ -385,3 +385,19 @@ fn drop(&mut self) { } } } + +#[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) => {{ $crate::DiagnosticId::Error(stringify!($code).to_owned()) }}; +}