Create new librustc_error_codes lib and move error codes declaration inside it

This commit is contained in:
Guillaume Gomez 2019-11-11 22:45:32 +01:00
parent a2491ee4e6
commit 3816fce76c
3 changed files with 13648 additions and 0 deletions

View File

@ -0,0 +1,9 @@
[package]
authors = ["The Rust Project Developers"]
name = "rustc_error_codes"
version = "0.0.0"
edition = "2018"
[lib]
name = "rustc_error_codes"
path = "lib.rs"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,26 @@
//! This library is used to gather all error codes into one place. The goal
//! being to make their maintenance easier.
#[macro_export]
macro_rules! register_diagnostics {
($($ecode:ident: $message:expr,)*) => (
$crate::register_diagnostics!{$($ecode:$message,)* ;}
);
($($ecode:ident: $message:expr,)* ; $($code:ident,)*) => (
pub static DIAGNOSTICS: &[(&str, &str)] = &[
$( (stringify!($ecode), $message), )*
];
$(
pub const $ecode: &str = $message;
)*
$(
pub const $code: () = ();
)*
)
}
mod error_codes;
pub use error_codes::*;